Flutter fatal error: 'Flutter/Flutter.h' file not found - ios

I am unable to build flutter project for iOS , gives me error as follows
Xcode's output:
↳
In file included from /Users/sulfy/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-2.0.5/ios/Classes/FLTPathProviderPlugin.m:5:
/Users/sulfy/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-2.0.5/ios/Classes/FLTPathProviderPlugin.h:5:9: fatal error: 'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>
^~~~~~~~~~~~~~~~~~~
1 error generated.
note: Using new build system
note: Planning
note: Build preparation complete
note: Building targets in parallel
tried
pod deintegrate
rm ios/Flutter/Flutter.podspec
flutter clean
flutter pub get
pod install
Clean derive data
flutter run
and still same, I am unable to get rid of this error.
I even tried removing path provider plugin from pubsec.yaml
Any help will be high appreciated as I'm stuck on this over 24 hours

Try Raffaelli L.C. answer:
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

Related

Building Flutter 2.* project with Firebase in IOS Simulator

I've been struggling to get this project to build successfully in IOS Simulator.
I get the following cryptic errors:
While building module 'firebase_core' imported from
/Users/shanejordan/Documents/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-2.5.2/ios/Classes/FLTSnapshotsInSyncStreamHan
dler.m:6:
In file included from <module-includes>:1:
In file included from /Users/shanejordan/Repositories/HH/flutter_test_ios/ios/Pods/Target Support
Files/firebase_core/firebase_core-umbrella.h:13:
In file included from
/Users/shanejordan/Documents/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-1.6.0/ios/Classes/FLTFirebaseCorePlugin.h:11:
/Users/shanejordan/Documents/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-1.6.0/ios/Classes/FLTFirebasePlugin.h:9:9:
error: include of non-modular header inside framework module 'firebase_core.FLTFirebasePlugin':
'/Users/shanejordan/Repositories/HH/flutter_test_ios/ios/Pods/Headers/Public/FirebaseCore/FirebaseCore.h'
[-Werror,-Wnon-modular-include-in-framework-module]
#import <FirebaseCore/FirebaseCore.h>
^
1 error generated.
/Users/shanejordan/Documents/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-2.5.2/ios/Classes/FLTSnapshotsInSyncStreamHan
dler.m:6:9: fatal error: could not build module 'firebase_core'
#import <firebase_core/FLTFirebasePluginRegistry.h>
I created a fresh project and was able to run it in iOS fine, but as soon as I add the pub for firebase_core, i can't get it to run in IOS simulator. I must be missing something very basic.
I've tried all of the options in this answer doing all the tricks such as rebuilding podfiles, opening xcode and changing settings. Nothing has worked. Header file (FirebaseCore/FirebaseCore.h) not found, despite importing Firebase.framework
Do these steps help you?
Remove ios/Pods folder.
Remove Podfile and Podfile.lock
Remove pubspec.lock
Open terminal and run these commands one after another
pod cache clean —all
flutter clean
flutter pub get
pod install

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 iOS application couldn't run with error app_settings not found

I have a flutter app, everything fine with Android studio and run on Android system smoothly without any problem
When I moved to iOS version, I start facing multiple problems and I solve it all, the last problem is missing app_settings, but the folder already created on the project root.
- I tried to run it through Xcode, it shows an error as shows on the picture:
- I tried to run this command (Flutter run) inside the project directory, it shows this error:
I tried this steps with no solutions:
Changed the rate_my_app version in Pubspec.yaml and Pubspec.lock
Then delete those files:
podfile - podfile.lock - pods folder - build folder
Then run those command inside the project directory:
pod init
add this lines to podfile:
pod 'GoogleMaps'
pod 'Firebase'
pod 'FirebaseAuth'
add this line to AppDelegate.swift
import FirebaseAuth
add this line to lib/models/user/user_model.dart
import 'package:app_settings/app_settings.dart';
then run this command
pod install
Then from Xcode > Product > Clean build folder
The run the app
FYI, the project shows a missing framework which I couldn't find any solution for that except deleting the record from the project every time it shows up.
I found a solution.
The problem was with ios/Flutter directory files, it was missing and some corrupted files.
What did I do is creating another Flutter project with the same project and Bundl name, then I copied the Flutter folder from the new project to my current one.
That fixed everything for me.

GoogleUtilities/GULSceneDelegateSwizzler.h file not found

Unable to build Flutter app on iOS/Xcode
Pubspec file with used dependencies
Already tried all the pod install/upgrade, flutter clean, pub install etc solutions.
Error message looks like this:
ios/Pods/FirebaseAuth/Firebase/Auth/Source/Auth/FIRAuth.m:32:9: fatal error:
'GoogleUtilities/GULSceneDelegateSwizzler.h' file not found
#import <GoogleUtilities/GULSceneDelegateSwizzler.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ios/Pods/FirebaseAuth/Firebase/Auth/Source/Auth/FIRAuth.m:32:9: note: did not find header
'GULSceneDelegateSwizzler.h' in framework 'GoogleUtilities' (loaded from 'build/ios/Debug-iphonesimulator/GoogleUtilities')
1 error generated.
Would be very grateful for any input on this issue.
Update pods from Terminal:
pod update
That should resolve your problem.
ps. backup your app before update
Move into iOS directory (in your flutter project) and update pod
cd ios
pod update
cd..
flutter clean

flutter_blue^0.6.3 file not found #import "google/protobuf/Any.pbobjc.h" Flutter

When I add flutter_blue: ^0.6.3 to my brand new project dependencies, I get the following error:
Xcode build done. 6.0s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
While building module 'protobuf' imported from /Users/johanalbrectsen/.pub-cache/hosted/pub.dartlang.org/flutter_blue-0.6.3/ios/gen/GPBArray.h:33:
In file included from <module-includes>:1:
In file included from /Users/johanalbrectsen/AndroidStudioProjects/flutter_blue_test/ios/Pods/Target Support Files/Protobuf/Protobuf-umbrella.h:28:
In file included from /Users/johanalbrectsen/AndroidStudioProjects/flutter_blue_test/ios/Pods/Protobuf/objectivec/GPBProtocolBuffers.h:44:
/Users/johanalbrectsen/AndroidStudioProjects/flutter_blue_test/ios/Pods/Protobuf/objectivec/GPBWellKnownTypes.h:44:10: fatal error: 'google/protobuf/Any.pbobjc.h' file not found
#import "google/protobuf/Any.pbobjc.h"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
In file included from /Users/johanalbrectsen/.pub-cache/hosted/pub.dartlang.org/flutter_blue-0.6.3/ios/Classes/FlutterBluePlugin.m:6:
In file included from /Users/johanalbrectsen/.pub-cache/hosted/pub.dartlang.org/flutter_blue-0.6.3/ios/gen/Flutterblue.pbobjc.h:13:
In file included from /Users/johanalbrectsen/.pub-cache/hosted/pub.dartlang.org/flutter_blue-0.6.3/ios/gen/GPBProtocolBuffers.h:33:
/Users/johanalbrectsen/.pub-cache/hosted/pub.dartlang.org/flutter_blue-0.6.3/ios/gen/GPBArray.h:33:9: fatal error: could not build module 'protobuf'
#import "GPBRuntimeTypes.h"
~~~~~~~^~~~~~~~~~~~~~~~~~~
2 errors generated.
note: Using new build systemnote: Planning buildnote: Constructing build description
Could not build the application for the simulator.
Error launching application on iPhone 11 Pro Max.
Do you have any idea how to fix this?
I had same problem and downgrading cocoapods to 1.7.5 worked for me.
Try with:
flutter clean
Delete Pod folder and Podfile.lock file inside the ios directory of your project
pod install
pod upgrade and then
flutter run on root directory of your project
this issue is discussed all over,
please check this answer on github
Yep, if someone encounter the same issue later, just like #Ritz_04 said, you just have to do downgrade cocoapods to 1.7.5 by doing :
sudo gem uninstall cocoapods --all
sudo gem install cocoapods -v 1.7.5
Then go into your Flutter project and then into the ios folder and do :
rm -rf ./Pods
rm ./Podfile.lock
pod install --repo-update
And you should be ready to go!

Resources