error with my code #import <Flutter/Flutter.h> - ios

There is my problem: I'm using the [share package][1] from pub.dev, and when I am trying to build my app, I got the following error:
#import <Flutter/Flutter.h>
^~~~~~~~~~~~~~~~~~~
1 error generated.
In file included from /Users//Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-2.0.5/ios/Classes/FLTSharedPreferencesPlugin.m:5:
/Users//Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-2.0.5/ios/Classes/FLTSharedPreferencesPlugin.h:5:9: fatal error: 'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>
^~~~~~~~~~~~~~~~~~~
1 error generated.
In file included from /Users/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-6.0.3/ios/Classes/FLTURLLauncherPlugin.m:7:
/Users/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-6.0.3/ios/Classes/FLTURLLauncherPlugin.h:5:9: fatal error: 'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>
^~~~~~~~~~~~~~~~~~~ ```

For Mac users:
In your flutter project, try running flutter pub get on the terminal.

To fix error: 'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>
you need to remove or not use
firebase_admob
use
native_admob_flutter
OR
admob_flutter
and you get this error when you use firebase
and if you use like this code in podfile
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
end
end
end

Related

'Flutter/Flutter.h' file not found flutter ios app

itry to build my app at ios device but I fount this error
Lexical or Preprocessor Issue (Xcode): 'Flutter/Flutter.h' file not found
/Users/sayed/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker_ios-0.8.6+7/ios/Classes/messages.g.m:6:8
Could not build the application for the simulator.
Error launching application on iPhone 13 Pro.
/Users/sayed/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker_ios-0.8.6+7/ios/Classes/messages.g.m:7: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 dependency order
Result bundle written to path:
/var/folders/w7/k04jz9bj3ks2p5b_x3xgvpym0000gn/T/flutter_tools.sEDlgq/flutter_ios_build_temp_dir2zMQpj/temporary_xcresult_bundle

i have this problem #import <Flutter/Flutter.h>

There is my problem:
I'm using the [share package][1] from pub.dev, and when I am trying to build my app, I got the following error:
/Users/yazan/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/share-0.6.5+4/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/yazan/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-2.0.5/ios/Classes/FLTSharedPreferencesPlugin.m:5:
/Users/yazan/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-2.0.5/ios/Classes/FLTSharedPreferencesPlugin.h:5:9: fatal error: 'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>
^~~~~~~~~~~~~~~~~~~
1 error generated.
In file included from /Users/yazan/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-6.0.3/ios/Classes/FLTURLLauncherPlugin.m:7:
/Users/yazan/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-6.0.3/ios/Classes/FLTURLLauncherPlugin.h:5:9: fatal error: 'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>
^~~~~~~~~~~~~~~~~~~ ```
[1]: https://pub.dev/packages/share

fatal error: 'Flutter/Flutter.h' file not found in flutter

This is the error -
In file included from
/Users/chetan/.pub-cache/hosted/pub.dartlang.org/webview_flutter-1.0.7/ios/Classes/JavaScriptChannelHandler.m:5:
/Users/chetan/.pub-cache/hosted/pub.dartlang.org/webview_flutter-1.0.7/ios/Classes/JavaScriptChannelHandler.h:5:9:
fatal error: 'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>
^~~~~~~~~~~~~~~~~~~
1 error generated.
In file included from /Users/chetan/.pub-cache/hosted/pub.dartlang.org/webview_flutter-1.0.7/ios/Classes/FlutterWebView.m:5:
/Users/chetan/.pub-cache/hosted/pub.dartlang.org/webview_flutter-1.0.7/ios/Classes/FlutterWebView.h:5:9:
fatal error: 'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>
^~~~~~~~~~~~~~~~~~~
1 error generated.
In file included from /Users/chetan/.pub-cache/hosted/pub.dartlang.org/webview_flutter-1.0.7/ios/Classes/FLTWebViewFlutterPlugin.m:5:
/Users/chetan/.pub-cache/hosted/pub.dartlang.org/webview_flutter-1.0.7/ios/Classes/FLTWebViewFlutterPlugin.h:5:9:
fatal error: 'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>
^~~~~~~~~~~~~~~~~~~ 1 error generated.
In file included from /Users/chetan/.pub-cache/hosted/pub.dartlang.org/webview_flutter-1.0.7/ios/Classes/FLTWKNavigationDelegate.m:5:
/Users/chetan/.pub-cache/hosted/pub.dartlang.org/webview_flutter-1.0.7/ios/Classes/FLTWKNavigationDelegate.h:5:9:
fatal error: 'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>
^~~~~~~~~~~~~~~~~~~
1 error generated.
In file included from /Users/chetan/.pub-cache/hosted/pub.dartlang.org/webview_flutter-1.0.7/ios/Classes/FLTCookieManager.m:5:
/Users/chetan/.pub-cache/hosted/pub.dartlang.org/webview_flutter-1.0.7/ios/Classes/FLTCookieManager.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
I get this error all the time! Usually when trying to build my iOS app.
Things that normally fix it are:
cd ~/ios/
rm -rf Pods
rm Podfile.lock
cd .. to (to get back to main flutter dir) flutter clean
If that doesn't work you can also try these afterwards
cd /ios/
pod deintegrate
pod install
If issues persist after those and this happens when trying to build your iOS app sometimes its a good idea to back up your iOS folder delete it and then run flutter create this will generate a new iOS folder so you have a fresh runner and can make a fresh pod file.
If none of my solutions worked for you can also check out this SO thread because this issue pops up a lot.

Adding Firebase/Messaging CocoaPod causes iOS app to not build

The iOS app worked fine before adding Firebase/Messaging, but after adding it and running 'pod update' I started getting these errors when building:
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_GTMLogger", referenced from:
objc-class-ref in FirebaseMessaging(GIPReachability_d54098c5c1e1fdc4fca31a4803478650.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Here is my current Podfile:
# Uncomment this line to define a global platform for your project
platform :ios, '9.0'
# Uncomment this line if you're using Swift
use_frameworks!
target 'KarmaSous' do
pod 'Firebase'
pod 'FirebaseMessaging'
pod 'Firebase/Database'
pod 'Kingfisher', '~> 3.1.4'
pod "GMStepper"
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3.0'
end
end
end
Any help would be greatly appreciated, thank you!
Have you tried adding pod 'Firebase/Messaging' instead of pod 'FirebaseMessaging'?
I had same error, and I have solved the error.
Please make sure that "Edit Scheme > Build > Build Options > Find Implicit Dependencies" is checked.

pch prefix clang error

I have my prefix pch file but I don't know why its giving me this error. Please help.
clang: error: no such file or directory: '/Users/djtakeuchi/Documents/Xcode Projects/Xcode Supplied Source Code/BirthdayReminder/BirthdayReminder/user-interface/view-controllers/../../BRBirthdayEditViewController.m'
clang: error: no input files
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1
prefix.pch file:
//
// Prefix header for all source files of the 'BirthdayReminder' target in the 'BirthdayReminder' project
//
#import <Availability.h>
#ifndef __IPHONE_5_0
#warning "This project uses features only available in iOS SDK 5.0 and later."
#endif
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#endif

Resources