Can't import Flutter module with Swift in Xcode - ios

When I import Flutter in Swift, Xcode is telling me No Such Module 'Flutter'
I have noticed there are Pods and Development Pods directories. Flutter resides in Development Pods.
Other modules in Pods are accessible.
Here is my Podfile:
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
platform :ios, '14.0'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
flutter_ios_podfile_setup
target 'Runner' do
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
pod 'TensorFlowLiteSwift/CoreML' #, '~> 0.0.1-nightly'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
Any ideas?

A shot in the dark but did you try just blowing everything out and seeing if pods fixes itself?
go into the ios folder
delete the Podfile.lock file
rm -rf Pods
pod cache clean --all
pod deintegrate
pod setup
pod install

Related

The 'Pods-Runner' target has frameworks with conflicting names: libavcodec.xcframework, libavdevice.xcframework, libavfilter.xcframework

I'm trying to run a flutter app on ios simulator. But, first I'm trying to run pod install command.
Some of the pods get installed but after Installing webview_flutter_wkwebview (0.0.1), I get the error
[!] The 'Pods-Runner' target has frameworks with conflicting names: libavcodec.xcframework, libavdevice.xcframework, libavfilter.xcframework, libavformat.xcframework, libavutil.xcframework, libswresample.xcframework, and libswscale.xcframework.
These are the things I've tried but failed:
Flutter Clean and re run after flutter pub get
flutter pub get && flutter pub run build_runner build --delete-conflicting-outputs
pod deintegrate and pod install
Flutter pub cache repair and flutter pub get.
Is there any other solution I can try? Thank You.
Here's my podfile:
# Uncomment this line to define a global platform for your project
platform :ios, '12.1'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
flutter_ios_podfile_setup
target 'Runner' do
use_frameworks!
use_modular_headers!
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
end
end
end

CocoaPods could not find compatible versions for pod "FirebaseAppCheck"

When i try to run my app on an ios device simulator (IOS 15.4) here what happen :
[!] CocoaPods could not find compatible versions for pod "FirebaseAppCheck":
In Podfile:
firebase_app_check (from .symlinks/plugins/firebase_app_check/ios) was resolved to 0.0.6-7, which depends on
FirebaseAppCheck (~> 7.7.0-beta)
None of your spec sources contain a spec satisfying the dependency: FirebaseAppCheck (~> 7.7.0-beta).
In my pubspec.yaml there is Firebase app firebase_app_check: ^0.0.6+7.
Here my podfile :
# Override Firebase SDK Version
$FirebaseSDKVersion = '7.7.0'
# Uncomment this line to define a global platform for your project
platform :ios, '10.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
flutter_ios_podfile_setup
target 'Runner' do
use_frameworks!
use_modular_headers!
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
end
end
end
Here what i already tried :
flutter clean
pod deintegrate
pod install -repo update
flutter pub get
deleting the pods directory and pod.lock and try pod install
Can someone help me ? Thanks in advance.
As #PaulBeusterien said :
I just had to update my podfile with the appropriate version for Firebase SDK and the appropriate plateform target.
Here my podfile below:
# Override Firebase SDK Version
$FirebaseSDKVersion = '8.5.0'
# Uncomment this line to define a global platform for your project
platform :ios, '11.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
flutter_ios_podfile_setup
target 'Runner' do
use_frameworks!
use_modular_headers!
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
end
end
end
Change the Firebase SDK version to at least 8.5.0.
AppCheck was introduced in Firebase 8.0.0 for iOS 11+ and support added for iOS 10 in 8.5.0.
See the available podspecs at https://github.com/CocoaPods/Specs/tree/master/Specs/1/8/e/FirebaseAppCheck

No such Module 'Flutter' : Xcode 13

I am trying to run my app on iphone device and constantly running into this error. I followed some answer to this error on stenter code hereack like removing the pod file and recreating it. Pasting the podfile for better understanding.-------------------------------------------------------------------
# Uncomment this line to define a global platform for your project
platform :ios, '12.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
flutter_ios_podfile_setup
target 'Runner' do
use_frameworks!
use_modular_headers!
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
end
end
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
Try Removing this line and follow this link
Xcode 12, building for iOS Simulator, but linking in an object file built for iOS, for architecture 'arm64'
Posted By Thomas Ward

Module 'firebase_analytics' not found when archiving ios(Flutter app)

I have been trying to archive my ios app for days but i keep getting this error. When i run in debug mode though, it builds successfully.
I've done these repeatedly but still no hope:
Adding GoogleService-info.plist via xcode
Flutter clean
Deleted podfile, podfile.lock, symlinks
Flutter pub get
pod install &&pod repo update
Launch Runner.xcworkspace in xcode
My podfile
platform :ios, '11.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
flutter_ios_podfile_setup
target 'Runner' do
use_frameworks!
use_modular_headers!
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
Firebase packages im using
firebase_core: ^0.5.3
firebase_analytics: ^6.3.0
firebase_messaging: ^7.0.3
firebase_dynamic_links: ^0.6.3
I also faced the same issue, here's what worked for me:
Add this in Pod file
target 'Runner' do
pod 'Firebase/Analytics'
end

"An error occurred while processing the post-install hook of the Podfile" in Flutter project

I am installing pod for my Flutter project but getting an error. I don't know why this error is occuring. It throws error at the very end of installing...........................................................................................
Pod file
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
flutter_ios_podfile_setup
target 'Runner' do
use_frameworks!
use_modular_headers!
use_frameworks!
pod 'CocoaMQTT/WebSockets', '1.3.0-rc.1'
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
Update your Ruby version, the version you are using is outdated.

Resources