Flutter cannot find FirebaseCore.h - ios

I'm trying to build a Flutter app for iOS, but I'm running into a weird issue where flutter build can't locate one of the header files (that's physically where it needs to be inside the Pods directory).
This is what I get when I try to build the app:
:ghost: zmeggyesi#Shiny-Platform:/Users/zmeggyesi/projects/site-overwatch/frontend/ios (tags/release-2.6.0)
$ flutter build ios --release --no-codesign --no-tree-shake-icons
Changing current working directory to: /Users/zmeggyesi/projects/site-overwatch/frontend
Warning: Building for device with codesigning disabled. You will have to manually codesign before deploying to device.
Building hu.skawa.dive-site-overwatch-ios for device (ios-release)...
Running pod install... 21.6s
Running Xcode build...
└─Compiling, linking and signing... 12.2s
Xcode build done. 50.8s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "Firebase.h"
^
/Users/zmeggyesi/projects/site-overwatch/frontend/ios/Pods/Firebase/CoreOnly/Sources/Firebase.h:15:9: error:
'FirebaseCore/FirebaseCore.h' file not found
#import <FirebaseCore/FirebaseCore.h>
^
/Users/zmeggyesi/projects/site-overwatch/frontend/ios/Runner/AppDelegate.swift:3:8: error: could not build Objective-C module
'Firebase'
import Firebase
^
Command CompileSwift failed with a nonzero exit code
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Analyzing workspace
note: Constructing build description
note: Build preparation complete
Encountered error while building for device.
And I'm kind of at a loss as to what might be causing this, or how to get around it.
The relevant Firebase declarations in my Pubspec:
firebase_core: 1.1.1
firebase_crashlytics: 2.0.3
firebase_analytics: 8.0.4
firebase_auth: 1.1.4
firebase_remote_config: 0.10.0-dev.3
firebase_storage: 8.0.6
So far, I've tried:
Nuking the Pods directory and the Podfile.
Commenting out the Firebase dependencies from my pubspec, followed by a flutter pub upgrade to update the lockfile, then doing a pod install before re-enabling them to re-download the pods.
Running flutter create . to regenerate the project descriptors.
Nuking the derived data dir (~/Library/Developer/Xcode/DerivedData), the Workspace descriptor, and the Pods/Podfile to regenerate everything from scratch.
This seems to be an issue only since I migrated to Flutter 2 and the latest packages, and only when I try to build in release mode (running the app in debug via XCode or Android Studio seems to work fine).
Correction: now even the XCode native build is broken, with the same error...
Anyone have any more ideas I could try? This is driving me crazy...

try to change global platform in Podfile this:
Uncomment the next line to define a global platform for your project
-# platform :ios, '9.0'
+ platform :ios, '13.0'

Related

How to fix Flutter Failed to build iOS app?

I updated my Xcode to Version 13.4 and android studio to Chipmunk and after this, I am getting below error while trying to build for ios. This issue is only occurring for ios builds.
Below is the log I am getting.
Xcode build done. 19.5s
Failed to build iOS app
Error output from Xcode build:
↳
2022-05-27 19:18:46.624 xcodebuild[62430:463863] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionSentinelHostApplications for extension Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
2022-05-27 19:18:46.624 xcodebuild[62430:463863] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
** BUILD FAILED **
Xcode's output:
↳
Writing result bundle at path:
/var/folders/6v/14mdnyyd4vs7gh4r1ry0hfxh0000gn/T/flutter_tools.IBcqbj/flutter_ios_build_temp_dirq4Dibw/temporary_xcresult_bundle
Failed to package /Users/bhaskarrajaryal/AndroidStudioProjects/PersonalProjects/FlutterProjects/testing.
Command PhaseScriptExecution failed with a nonzero exit code
note: Using new build system
note: Planning
note: Build preparation complete
note: Building targets in dependency order
Result bundle written to path:
/var/folders/6v/14mdnyyd4vs7gh4r1ry0hfxh0000gn/T/flutter_tools.IBcqbj/flutter_ios_build_temp_dirq4Dibw/temporary_xcresult_bundle
Could not build the application for the simulator.
Error launching application on iPhone 11.
Can anyone help me with this as I am stuck for fews day because of this?
The problem here is that the Podfile that Flutter template creates by
default has no specific iOS version set unfortunately.
Do this to fix this problem:
in ios/ folder of your project, open the Podfile.
At top of Podfile, make sure this line is not commented out and change the iOS version to 12.0.
change from:
#platform :ios, '8.0'
to:
platform :ios, '12.0'
Run pod deintegrate in Terminal inside the ios/ folder of your project.
Run pod install --repo-update in your ios/ folder
This should do the trick!
If after this you are getting the following error
CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target
Then you need to open your iOS workspace in Xcode and select your root project on top left, then inside the Info tab, choose your configuration (in this case Debug) and change it to None. After that, do pod install again.
HERE PICTURE :
CLICK HERE

fatal error: 'openssl/x509.h' file not found in Flutter iOS build after integrating firestore

My Flutter app was integrated with Firebase and the app was building successfully with Firebase core and auth. However when I added the cloud_firestore: ^2.2.0 dependency, the build fails on iOS (still works on Android) with the following error message:
In file included from /Users/charismak/AndroidStudioProjects/foodstack/ios/Pods/gRPC-Core/src/core/ext/filters/client_channel/xds/xds_channel_secure.cc:34:
In file included from /Users/charismak/AndroidStudioProjects/foodstack/ios/Pods/gRPC-Core/src/core/lib/security/credentials/credentials.h:35:
In file included from /Users/charismak/AndroidStudioProjects/foodstack/ios/Pods/gRPC-Core/src/core/lib/security/security_connector/security_connector.h:33:
/Users/charismak/AndroidStudioProjects/foodstack/ios/Pods/gRPC-Core/src/core/tsi/ssl_transport_security.h:28:10: fatal error: 'openssl/x509.h' file not found
#include <openssl/x509.h>
^~~~~~~~~~~~~~~~
1 error generated.
When I remove the dependency, it builds successfully.
I have tried running pod install, flutter clean, changing the deployment target on Xcode and podfile, and installing/upgrading openssl.
It is the same issue as this: Not found 'openssl/x509.h' when install cloud_firesore flutter?
I solved it by running the following commands in terminal inside <your_project_path>/ios:
rm -rf Pods Podfile.lock
pod cache clean --all
pod install
(Installation may take some time to complete)
Source: https://github.com/FirebaseExtended/flutterfire/issues/3203#issuecomment-743789416

Flutter AMSupportURLConnectionDelegate is implemented in both ?? Error

I am facing many issues since I migrated my project to an Apple Silicon mac. I finally managed to reduce the problems but not sure the answer to this.
Running "flutter pub get" in Flutter_the app copy 3... 760ms
Launching lib/main.dart on iPhone 11 in debug mode...
Running pod install... 986ms
Running Xcode build...
Xcode build done. 1.5s
Failed to build iOS app
Error output from Xcode build:
↳
objc[95181]: Class AMSupportURLConnectionDelegate is implemented in both ?? (0x20ba238f0) and ??
(0x1160dc2b8). One of the two will be used. Which one is undefined.
objc[95181]: Class AMSupportURLSession is implemented in both ?? (0x20ba23940) and ?? (0x1160dc308). One
of the two will be used. Which one is undefined.
** BUILD FAILED **
Xcode's output:
↳
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
error: /Users/gorkem/Documents/flutter_workspace/Flutter_the app copy 3/ios/Flutter/Debug.xcconfig:
unable to open file (in target "Runner" in project "Runner") (in target 'Runner' from project 'Runner')
error: /Users/gorkem/Documents/flutter_workspace/Flutter_the app copy 3/ios/Flutter/Debug.xcconfig:
unable to open file (in target "Runner" in project "Runner") (in target 'Runner' from project 'Runner')
error: /Users/gorkem/Documents/flutter_workspace/Flutter_the app copy 3/ios/Flutter/Debug.xcconfig:
unable to open file (in target "Runner" in project "Runner") (in target 'Runner' from project 'Runner')
warning: Unable to read contents of XCFileList '/Target Support
Files/Pods-Runner/Pods-Runner-frameworks-Debug-output-files.xcfilelist' (in target 'Runner' from project
'Runner')
error: Unable to load contents of file list: '/Target Support
Files/Pods-Runner/Pods-Runner-frameworks-Debug-input-files.xcfilelist' (in target 'Runner' from project
'Runner')
error: Unable to load contents of file list: '/Target Support
Files/Pods-Runner/Pods-Runner-frameworks-Debug-output-files.xcfilelist' (in target 'Runner' from project
'Runner')
Could not build the application for the simulator.
Error launching application on iPhone 11.
Is there any way to solve this. I am not sure if the problem is even written in there.
I was getting this error
Class AMSupportURLConnectionDelegate is implemented in both /usr/lib/libauthinstall.dylib
NOTE:
Try this first if you have updated to flutter 2.10 from <=2.8
flutter pub upgrade
Solution:
Please open podfile and update with this script
installer.pods_project.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
flutter clean
flutter pub get
cd ios
pod install
or instead of last command you can try below for M1
arch -x86_64 pod install // for M1
Run your app.
I was getting the same "error output from Xcode build" with my M1 macbook recently as well after updating to Flutter 2.x.
I was able to clear this issue on mine by doing the following:
Change directory to your project's path and sub-directory:
your_project/build/ios/Debug-iphonesimulator/
Run $ xattr -lr Runner.app
Run $ xattr -cr Runner.app
Apparently flutter projects have extended attributes in project app bundles containing Finder info which causes an error.
I found these links that helped for reference.
https://developer.apple.com/library/archive/qa/qa1940/_index.html
https://github.com/flutter/flutter/issues/72492
Try Selecting For install builds only in the run script in the Build phases tab.
Two things need to change:
First check the Dependancy for APNs if need to upgrade. Then Change the version in the POD file and then add
pod 'GoogleUtilities'
To the POD target like following:
target 'Runner' do
use_frameworks!
use_modular_headers!
flutter_install_all_macos_pods File.dirname(File.realpath(FILE))
pod 'GoogleUtilities'
end
.
After this Run Flutter pug get and Flutter run. It works for me.
Ref screenshot for POD file

error: 'Flutter/Flutter.h' file not found when flutter run on iOS

I don't know why but I can't build or run the App in my new Macbook, I run the same folder on another Mac or my windows computer and runs perfectly.
here when I run flutter clean, I have to run pub get to solve the issues, Is that normal?
If I create a new project, I can run flutter run normally, so I think that maybe there
I think it may be related to plugins.
Do you know how can I solve this? Thanks
Flutter Doctor
[✓] Flutter (Channel master, 1.24.0-8.0.pre.343, on macOS 11.0.1 20B29 darwin-x64, locale es-419)
• Flutter version 1.24.0-8.0.pre.343 at /Users/leo/tools/flutter
• Framework revision cf6c33e58a (2 days ago), 2020-11-21 14:04:01 -0800
• Engine revision 23a8e027db
• Dart version 2.12.0 (build 2.12.0-62.0.dev)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at /Users/leo/Library/Android/sdk
• Platform android-30, build-tools 30.0.2
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 12.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.2, Build version 12B45b
• CocoaPods version 1.9.3
[✓] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
[✓] Connected device (2 available)
• sdk gphone x86 arm (mobile) • emulator-5554 • android-x86 • Android 11 (API
30) (emulator)
• iPhone 12 Pro Max (mobile) • F768139D-7B87-4D9E-93B8-14C7D63786B0 • ios •
com.apple.CoreSimulator.SimRuntime.iOS-14-2 (simulator)
• No issues found!
Launching lib/main.dart on iPhone 12 Pro Max in debug mode...
Running Xcode build...
Xcode build done. 11.4s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "Headers/vibration-umbrella.h"
^
/Users/leo/Apps/previate_esta/ios/Pods/Target Support Files/vibration/vibration-umbrella.h:13:9: note:
in file included from /Users/leo/Apps/previate_esta/ios/Pods/Target Support
Files/vibration/vibration-umbrella.h:13:
#import "VibrationPlugin.h"
^
/Users/leo/.pub-cache/hosted/pub.dartlang.org/vibration-1.4.0/ios/Classes/VibrationPlugin.h:1:9: error:
'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>
^
<unknown>:0: error: could not build Objective-C module 'vibration'
In file included from
/Users/leo/.pub-cache/hosted/pub.dartlang.org/url_launcher-5.5.3/ios/Classes/FLTURLLauncherPlugin.m:7:
/Users/leo/.pub-cache/hosted/pub.dartlang.org/url_launcher-5.5.3/ios/Classes/FLTURLLauncherPlugin.h:5:9
: fatal error: 'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>
^~~~~~~~~~~~~~~~~~~
1 error generated.
In file included from
/Users/leo/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.10/ios/Classes/FLTSharedPreference
sPlugin.m:5:
/Users/leo/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.10/ios/Classes/FLTSharedPreference
sPlugin.h:5:9: fatal error: 'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>
^~~~~~~~~~~~~~~~~~~
1 error generated.
In file included from
/Users/leo/.pub-cache/hosted/pub.dartlang.org/share-0.6.5/ios/Classes/FLTSharePlugin.m:5:
/Users/leo/.pub-cache/hosted/pub.dartlang.org/share-0.6.5/ios/Classes/FLTSharePlugin.h:5:9: fatal
error: 'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>
^~~~~~~~~~~~~~~~~~~
1 error generated.
In file included from
/Users/leo/.pub-cache/hosted/pub.dartlang.org/sensors-0.4.2+4/ios/Classes/FLTSensorsPlugin.m:5:
/Users/leo/.pub-cache/hosted/pub.dartlang.org/sensors-0.4.2+4/ios/Classes/FLTSensorsPlugin.h:5:9: fatal
error: 'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>
^~~~~~~~~~~~~~~~~~~
1 error generated.
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
Could not build the application for the simulator.
Error launching application on iPhone 12 Pro Max.
I found a solution!
Backup ios/Runner folder.
Delete the ios folder.
Run flutter create (your project name). in the previous folder where you have your project(cd users/user/"projects_folder")
(this will recreate your ios folder).
Paste your Runner backup in the ios folder (into the project).
Open Runner.xcworkspace (into ios folder) and there, check the Version, the Bundle ID, all the info.
(If do you Have Firebase, you have to copy and paste again the Google Service-Info.Plist into the Runner folder (Always through Xcode) (If do you do this manually, it doesn't work).
Finally, flutter run and should work!
If flutter run fails:
cd ios
pod install
cd ..
flutter run
A way easier solution:
Remove ios/Flutter/Flutter.podspec: rm ios/Flutter/Flutter.podspec
flutter clean
Run your app again.
Taken from here
This solution worked for me:
Changing PodFile from:
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '10.0'
end
end
end
to
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
Edit: a new version of Crashlytics has just been release for Flutter 2. Just upgrade your pubspec.yml:
firebase_crashlytics: ^2.0.0
Below is my old answear.
For Flutter 2, you can follow the instructions in this GitHub comment. Text pasted below:
Workaround for Flutter 2.0.4 is to use firebase_crashlytics from git
instead of pub.dev. This seems to work (ref to the currently latest
commit):
firebase_crashlytics:
git:
url: git://github.com/FirebaseExtended/flutterfire.git
path: packages/firebase_crashlytics/firebase_crashlytics
ref: 200b8ca8f1c452e4249fb791e53cc55e786ac768
It might happen that particular iOS POD depedency does not have Flutter dependency.
In my case it was firebase_crashlytics: ^1.0.0
Unfortunately it is up to maintainer to provide working solution. You might remove cached version located at:
/Users/user/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_crashlytics-1.0.0/ios/firebase_crashlytics.podspec
Please visit this issue for reference.
The .podspec for particular 3rd party lib should have:
s.dependency 'Flutter'
in
Pod::Spec.new do |s|
...
Then, invoke pod install in ios directory, to reflect the change.
Lastly, schedule your build.
Solution 1
Back up the Runner folder in your ios folder to a safe place.
Delete the ios folder:
Still in the root directory, run the following command( including the space and period):
flutter create .
A new ios folder will be generated inside your project.
Copy and paste the Runner folder you have backed up before to the new ios folder:
A dialog will appear. Click on the Replace button to continue.
If your project is NOT using Firebase, you can ignore this step and move on to the next one. Otherwise, you need to re-add the GoogleService-Info.plist file by opening the ios folder with Xcode, right-click on Runner, choose Add Files to “Runner” from the drop-down menu, then select the GoogleService-Info.plist file that is associated with your project.
Navigate to your ios folder and run:
pod install
You may fall into something like this:
# Uncomment this line to define a global platform for your project
platform :ios, '11.0'
Now run pod install again, and it should work (a few warnings may appear, but we don’t care about them).
Finally, go back to your root directory and run your project as normal (don’t forget to launch an iOS simulator first):
cd ..
flutter run
If you still get errors, clear the Flutter’s build cache by executing this:
flutter clean
And update dependencies in .pub-cache:
flutter pub cache repair
Then run your project again.
Solution 2
Occasionally, the error is caused by a simple reason: you are currently on the Master channel instead of the Stable channel. According to the Flutter wiki:
Master channel: The current tip-of-tree, absolute latest cutting edge build. Usually functional, though sometimes things accidentally break.
Stable channel: This channel is strongly recommend to use for all production app releases.
What you need to do now is to switch to the stable channel:
flutter channel stable
Then:
flutter clean
Finally:
flutter run
Solution 3
You could try this if the two approaches above didn’t solve the problem.
Go to /ios folder and delete the following:
Flutter/Flutter.podspec file
Pods folder
Podfile.lock file
Still in the ios folder, execute the following command:
pod install --repo-update
Navigate to the root directory of your project and clean your project by running this command:
flutter clean
Run it:
flutter run
Hope this helps... Credit: A Goodman
In My case i have fix the issue
Runner -->Build phases--->Untick for install only
I tried all the above solutions and but I ended up re-creating the ios directory.
rm -rf ios
flutter create -i swift .
Note: by performing the above steps will lose all native ios setup. In my case I was getting this error in the demo project I did this.
If Flutter permission_handler Related
If you've just integrated permission_handler for flutter into your app, and followed instructions to modify the ios podfile to add needed permissions, you may encounter this error using the provided instructions.
I started receiving the fatal error: 'Flutter/Flutter.h' file not found error after modifying the podfile.
Solution
The solution is to change the way the podfile modification is made so that flutter_additional_ios_build_settings(target) is properly and included, with proper nesting for the target.build_configurations.each... array.
Example Podfile Modification
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
# You can enable the permissions needed here. For example to enable camera
# permission, just remove the `#` character in front so it looks like this:
#
# ## dart: PermissionGroup.camera
# 'PERMISSION_CAMERA=1'
#
# When enabled here, corresponding metadata should be added to info.plist
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
'$(inherited)',
## dart: PermissionGroup.calendar
# 'PERMISSION_EVENTS=1',
## dart: PermissionGroup.reminders
# 'PERMISSION_REMINDERS=1',
## dart: PermissionGroup.contacts
# 'PERMISSION_CONTACTS=1',
## dart: PermissionGroup.camera
# 'PERMISSION_CAMERA=1',
## dart: PermissionGroup.microphone
# 'PERMISSION_MICROPHONE=1',
## dart: PermissionGroup.speech
# 'PERMISSION_SPEECH_RECOGNIZER=1',
## dart: PermissionGroup.photos
# 'PERMISSION_PHOTOS=1',
## dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse]
# 'PERMISSION_LOCATION=1',
## dart: PermissionGroup.notification
# 'PERMISSION_NOTIFICATIONS=1',
## dart: PermissionGroup.mediaLibrary
# 'PERMISSION_MEDIA_LIBRARY=1',
## dart: PermissionGroup.sensors
# 'PERMISSION_SENSORS=1',
## dart: PermissionGroup.bluetooth
# 'PERMISSION_BLUETOOTH=1',
## dart: PermissionGroup.appTrackingTransparency
# 'PERMISSION_APP_TRACKING_TRANSPARENCY=1',
## dart: PermissionGroup.criticalAlerts
# 'PERMISSION_CRITICAL_ALERTS=1'
]
end
end
end
Something that worked for me:
Some of the dependencies in my pubspec were outdated (specifically I was using crashalytics 1.0.0 with Flutter 2.0.5, which are incompatible and thus throwing this error).
Upgrading crashalytics to 2.0.0 fixed it for me.
I would look into whatever package is throwing this error, and see if any upgrades are available.
If that does not work, try downgrading your flutter version.
Use this commend in your terminal:
flutter pub cache repair
Yet another approach...
If you stumble across this issue in a Flutter project that uses Firebase, and non of the above steps worked, try the following:
Backup your project (just in case).
Delete the whole ios folder insider your Flutter project.
Call flutter create <projectname> at the parent folder of your flutter project (i.e. one folder above). This will recreate the ios folder.
Move the GoogleService-Info.plist file to your project in Xcode.
Now to the important part: When you follow the instructions at Firebase console under "Add firebase to your iOS app", skip step 3 (Add Firebase SDK) and skip step 4 (Add initialization code). In other words: Don't call pod init and don't call pod install. Also keep the AppDelegate unchanged! Instead simply call flutter run, which handles setting up the pods.
In ios/Podfile: Uncomment the line platform :ios, '8' and set the iOS version (12.1 seems to be a good fit at the time of writing). Set the same version in Xcode at PROJECT -> Runner -> Deployment Target -> iOS Deployment Target and (also in Xcode) under TARGETS -> Runner -> Deployment Info.
Call flutter clean and flutter run
With a little luck you've got it back running.
I hit my head for 3 days with this error.
In my case,
This error was happening due to a plugin :
webview_flutter.
This is how approached to this problem:
1.) remove that plugin from pubspec.yaml
2.) cd ios
3.) pod deintegrate
4.) again add that plugin in pubspec.yaml
5.) flutter clean
6.) flutter pub get
7.) cd iOS
8.) pod install
This should work! It worked in my project.
The reason might be Podfile conflict. (ex. in case : after merge source code .v.v.)
It is easy way,
re-install Pod file.
To completely clean (Removing all points to links) and create upgraded to the new (uninstall and installing again too),
Write following command :
flutter clean
rm -Rf ios/Pods
rm -Rf ios/.symlinks
rm -Rf ios/Flutter/Flutter.framework
rm -Rf ios/Flutter/Flutter.podspec
Then for reproduce Podfile follow this command
rm ios/Podfile
Finally your project is ready to good to go
flutter run
I think the case and solution would be varied but try and fail each case on this post is sometimes still helpful.
My case:
Repair pub cache
flutter pub cache repair
Run your project, this should show if any dependency those the pod obsolete with
flutter run
Get rid of your flutter build
flutter clean
rm ios/Podfile
Update the pod
pod repo update
Run your project again and hope it works out
flutter run
Change inside Podfile
#platform :ios, '9.0'
Uncomment this line to define a global platform for your project in the Podfile
platform :ios, '13.0'
Tested in VSCode ✅ It will save your 3 hours.
Deleted these files, and recrete as #Raffaelli L.C. answered.
flutter run command worked now
the solution is to
1 - change your flutter sdk location and make sure that your flutter sdk new location doesnot have any space char
2 - delete your pods
3 - flutter clean
4 - flutter pub get
5 - cd ios
6 - pod install
7 - flutter run
In file included from /Users/user/.pub-cache/hosted/pub.dartlang.org/firebase_crashlytics-0.4.0+1/ios/Classes/FLTFirebaseCrashlyticsPlugin.m:5:
/Users/user/.pub-cache/hosted/pub.dartlang.org/firebase_crashlytics-0.4.0+1/ios/Classes/FLTFirebaseCrashlyticsPlugin.h:8:9: fatal error: 'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>
^~~~~~~~~~~~~~~~~~~
While building module 'firebase_core' imported from /Users/user/.pub-cache/hosted/pub.dartlang.org/firebase_crashlytics-0.4.0+1/ios/Classes/FLTFirebaseCrashlyticsPlugin.h:12:
In file included from <module-includes>:1:
In file included from /Users/user/Documents/Projects/Vorso-Maui/flutter/vorso_maui/ios/Pods/Target Support Files/firebase_core/firebase_core-umbrella.h:13:
/Users/user/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.7.0/ios/Classes/FLTFirebaseCorePlugin.h:8:9: fatal error: 'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>
^~~~~~~~~~~~~~~~~~~
1 error generated.
2 errors generated.
As mentioned by other responses here, Firebase Crashlytics caused this error for me, due to [firebase_crashlytics] 'Flutter/Flutter.h' file not found #5440
The version of the last legacy release of Firebase Crashlytics was 0.4.0+1, which did not include the fix. The fix was included in a later null-safe version (v2.0.0).
However, when I tried to use versions v2+ in which the bug had been fixed, I got trapped in dependency hell - unresolvable conflicts between dependencies / sub-dependencies.
So, I created a fork (firebase_crashlytics_legacy) to provide the fix in a legacy compatible version.
This forked version is 0.4.0+x for consistency.
Hopefully it helps make it easy for others to use the legacy version with this bug fixed.
I'd a similar problem, in my case I wasn't able to build my project even using command line or using xCode, but when I ran pod install --verbose I realize that there was an specific error during pod install
undefined method `each_child' for #Dir:0x00007ff10befa7f0 Did you mean? each_slice
Looking for this specific error I found this answer and I realize that I was using ruby 2.5 and one file generated by Flutter for iOS devices was trying to use a method that was introduced on version 2.6.
After follow the steps on that answer I could run my Flutter app on iOS simulator.
The method dir.each_child was introduced in Ruby 2.6, but you are using Ruby 2.3.0.
You should update Ruby to 2.6.0 or later 2.x version.
After Ruby updating you may also need to restart your IDE and re-install cocoapods.
I got it solved by Adding arm64 for Excluded Architectures in pods & main target.
If you only encounter this problem when running "flutter build ipa", in XCode make sure your Deployment Info under Runner and Pods matches the 'platform' in ios/Podfile.
here is how i solved the problem:
run on your terminal flutter packages upgrade
create a backup of your 'iOS' folder on the project.
delete your 'iOS' folder from your project.
run flutter clean
run flutter pub get
run flutter create . on your root project directory
This will create an 'ios' folder in the repo. Copy the Info.plist, Podfile and any other config files like GoogleServices.plist from the backup 'ios' folder to the newly created 'ios' folder.
try to run your project again. it should be work now:)
I was stuck at this error message for months !
After a lot of trial and errors I finally, finally got it working and these were the steps I followed.
Go to your project folder, delete the ios folder in the project
Create a new project by running flutter create .
This step actually did not work for me because my project name was CamelCase, and maybe a recent update for Flutter did not allow this as the project name. I had to change the project name throughout the project before I ran this command.
Step 2 actually created a new project inside my existing one, but don't worry about that, all you require is the ios folder from that.
Copy-paste this ios folder into your project folder and delete the newly created project folder, you don't need this anymore (I am sure there is a better way to do this).
Flutter run gave me a Could not locate configuration file: 'GoogleService-Info.plist' error, this was easily solved by getting the latest GooglService file from Firebase and adding in through X-code.
Then flutter run, ran on my physical device and voila !
This error is due to not using the appropriate flutter version. Your packages are written in old flutter version. You can update packages to latest versions or you can revert to the flutter version appropriate for the packages you use in your project.
1-Run flutter create (your project name). in the previous folder where you have your project(cd users/user/"projects_folder") (this will recreate your ios folder).
2-uncomment #platform :ios, '9.0' in the Podfile - i set that '10.0'
3-pod repo update
4-pod install
Flutter version on my mac was higher than the flutter version where I coded the application on… So I just downgraded my flutter to the version I coded on And tada Error resolved Make sure you are on the same version of flutter as the laptop you coded on In my case I coded it on old version of flutter on my windows laptop and tired to run on latest version of flutter so the error popped up.
If this is your case then go through the below link -
Flutter simulator error: Command PhaseScriptExecution failed with a nonzero exit code
A really simple solution that worked for me was simply: close the xcode project. Then, on Android Studio, build the iOS archive by going to Build -> Flutter -> Build iOS. Then reopen the xcode project and it built and ran fine.
This happened me too. After follow below steps problem sorted for me !
Back up the Runner folder in your ios folder to a safe place.
Delete the ios folder:
Go to the root directory, run the following command:
flutter create .
After above step, will create ios folder. Copy and paste the Runner folder you have backed up before to the new ios folder:
Run the project in android studio or VS code
Navigate to your ios folder and run:
pod install
ios > Runner.xcworkspace right click and Flutter > Open iOS module in xCode
It will work :)
Copy info.plist, Assets.xcassets and other important files.
Create a New project with same name and bundle id.
Add an iOS project in your old project and add 1st step information in that.
Run project. It's working now.

firebase_messaging version 3.0.0 failed to build with IOS

when upgrade firebase_messaging to version 3.0.0 it is work correctly with android but in IOS build failed
BUILD TARGET firebase_messaging OF PROJECT Pods WITH CONFIGURATION Debug
/Users/----/Libraries/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-3.0.0/ios/Classes/FirebaseMessagingPlugin.m:79:33: error: expected ')'
instanceIDWithHandler:^(FIRInstanceIDResult *_Nullable instanceIDResult,
Please open up a terminal and navigate to your Flutter project directory.
Clean via flutter clean
Then cd into the iOS Folder and execute pod install
You may also want to update your pods via pod update
You may be able to run your project now.

Resources