Flutter ios " Could not build the application for the simulator." - ios

I have an android app written with Flutter.
Now I am trying to ios version of it and I am getting errors. I tried to run empty flutter project, and it works successfully.
No errors with pod install
After I tried flutter run I am getting these errors.
My pod file on below.
How can I solve this problem?
Flutter run output:
Xcode's output:
↳
/usr/local/Caskroom/flutter/2.2.3/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter-2.0.9/ios/Classes/FlutterWebView.m:395:23:
warning: 'requiresUserActionForMediaPlayback' is deprecated: first deprecated in iOS 10.0 [-Wdeprecated-declarations]
configuration.requiresUserActionForMediaPlayback = true;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mediaTypesRequiringUserActionForPlayback
In module 'WebKit' imported from
/usr/local/Caskroom/flutter/2.2.3/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter-2.0.9/ios/Classes/FlutterWebView.h:6:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Framew
orks/WebKit.framework/Headers/WKWebViewConfiguration.h:213:28: note: 'requiresUserActionForMediaPlayback' has been explicitly marked
deprecated here
#property (nonatomic) BOOL requiresUserActionForMediaPlayback API_DEPRECATED_WITH_REPLACEMENT("mediaTypesRequiringUserActionForPlayback",
ios(9.0, 10.0));
^
/usr/local/Caskroom/flutter/2.2.3/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter-2.0.9/ios/Classes/FlutterWebView.m:407:23:
warning: 'requiresUserActionForMediaPlayback' is deprecated: first deprecated in iOS 10.0 [-Wdeprecated-declarations]
configuration.requiresUserActionForMediaPlayback = false;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mediaTypesRequiringUserActionForPlayback
In module 'WebKit' imported from
/usr/local/Caskroom/flutter/2.2.3/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter-2.0.9/ios/Classes/FlutterWebView.h:6:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Framew
orks/WebKit.framework/Headers/WKWebViewConfiguration.h:213:28: note: 'requiresUserActionForMediaPlayback' has been explicitly marked
deprecated here
#property (nonatomic) BOOL requiresUserActionForMediaPlayback API_DEPRECATED_WITH_REPLACEMENT("mediaTypesRequiringUserActionForPlayback",
ios(9.0, 10.0));
^
2 warnings generated.
/usr/local/Caskroom/flutter/2.2.3/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.2/ios/Classes/InAppBrowser/InAppBrow
serWebViewController.swift:557:13: warning: setter for 'statusBarStyle' was deprecated in iOS 9.0: Use -[UIViewController
preferredStatusBarStyle]
UIApplication.shared.statusBarStyle = UIStatusBarStyle(rawValue: previousStatusBarStyle)!
^
/usr/local/Caskroom/flutter/2.2.3/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.2/ios/Classes/SafariViewController/S
afariBrowserOptions.swift:34:16: warning: unnecessary check for 'iOS'; enclosing scope ensures guard will always be true
if #available(iOS 10.0, *) {
^
/usr/local/Caskroom/flutter/2.2.3/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.2/ios/Classes/SafariViewController/S
afariBrowserOptions.swift:12:14: note: enclosing scope here
public class SafariBrowserOptions: Options<SafariViewController> {
^
/usr/local/Caskroom/flutter/2.2.3/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.2/ios/Classes/SafariViewController/S
afariViewController.swift:66:12: warning: unnecessary check for 'iOS'; enclosing scope ensures guard will always be true
if #available(iOS 10.0, *) {
^
/usr/local/Caskroom/flutter/2.2.3/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.2/ios/Classes/SafariViewController/S
afariViewController.swift:12:14: note: enclosing scope here
public class SafariViewController: SFSafariViewController, FlutterPlugin, SFSafariViewControllerDelegate {
^
/usr/local/Caskroom/flutter/2.2.3/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.2/ios/Classes/SafariViewController/S
afariBrowserOptions.swift:34:16: warning: unnecessary check for 'iOS'; enclosing scope ensures guard will always be true
if #available(iOS 10.0, *) {
^
/usr/local/Caskroom/flutter/2.2.3/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.2/ios/Classes/SafariViewController/S
afariBrowserOptions.swift:12:14: note: enclosing scope here
public class SafariBrowserOptions: Options<SafariViewController> {
^
/usr/local/Caskroom/flutter/2.2.3/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.2/ios/Classes/SafariViewController/S
afariViewController.swift:66:12: warning: unnecessary check for 'iOS'; enclosing scope ensures guard will always be true
if #available(iOS 10.0, *) {
^
/usr/local/Caskroom/flutter/2.2.3/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.2/ios/Classes/SafariViewController/S
afariViewController.swift:12:14: note: enclosing scope here
public class SafariViewController: SFSafariViewController, FlutterPlugin, SFSafariViewControllerDelegate {
^
/usr/local/Caskroom/flutter/2.2.3/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.2/ios/Classes/Types/URLCredential.sw
ift:14:25: warning: comparing non-optional value of type '[Any]' to 'nil' always returns true
if certificates != nil {
~~~~~~~~~~~~ ^ ~~~
/usr/local/Caskroom/flutter/2.2.3/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.2/ios/Classes/Util.swift:86:25:
warning: 'spotlightSuggestion' was deprecated in iOS 10.0: renamed to 'WKDataDetectorTypes.lookupSuggestion'
return .spotlightSuggestion
^
/usr/local/Caskroom/flutter/2.2.3/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.2/ios/Classes/Util.swift:86:25:
note: use 'WKDataDetectorTypes.lookupSuggestion' instead
return .spotlightSuggestion
^~~~~~~~~~~~~~~~~~~
WKDataDetectorTypes.lookupSuggestion
/usr/local/Caskroom/flutter/2.2.3/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.2/ios/Classes/Util.swift:121:31:
warning: 'spotlightSuggestion' was deprecated in iOS 10.0: renamed to 'WKDataDetectorTypes.lookupSuggestion'
if type.contains(.spotlightSuggestion) {
^
/usr/local/Caskroom/flutter/2.2.3/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.2/ios/Classes/Util.swift:121:31:
note: use 'WKDataDetectorTypes.lookupSuggestion' instead
if type.contains(.spotlightSuggestion) {
^~~~~~~~~~~~~~~~~~~
WKDataDetectorTypes.lookupSuggestion
/usr/local/Caskroom/flutter/2.2.3/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.2/ios/Classes/Util.swift:216:21:
warning: immutable value 'j' was never used; consider replacing with '_' or removing it
for j in ipv6.count...8 {
^
_
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_GULAppEnvironmentUtil", referenced from:
objc-class-ref in FIRCLSApplication.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_GULAppEnvironmentUtil", referenced from:
objc-class-ref in FIRCLSApplication.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_GULAppEnvironmentUtil", referenced from:
objc-class-ref in FIRCLSApplication.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Analyzing workspace
note: Constructing build description
note: Build preparation complete
warning: Stale file
'/Users/emre/Desktop/freegamescodes/build/ios/Debug-iphonesimulator/Runner.app/Frameworks/flutter_local_notifications.framework' is
located outside of the allowed root paths.
Could not build the application for the simulator.
Error launching application on iPhone 12 Pro Max.
My Pod file:
# Uncomment this line to define a global platform for your project
platform :ios, '10.0'
pod 'Firebase'
pod 'Firebase/Crashlytics'
pod 'Firebase/Analytics'
pod 'Firebase/Messaging'
pod 'Google-Mobile-Ads-SDK'
# 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.delete 'IPHONEOS_DEPLOYMENT_TARGET'
end
end

Open lib/ios folder and delete
Podfile
Podfile.lock
Pods folder
Runner.xcworkspace
then run flutter build ios
After building ios, run open ios/Runner.xcworkspace/ and then run project in XCode for the first time, after that, everything would work fine.

Backup your project and try this command : flutter clean && \ rm ios/Podfile ios/Podfile.lock pubspec.lock && \ rm -rf ios/Pods ios/Runner.xcworkspace && \ flutter run

take a backup of project then delete ios folder and use command "flutter create ."
don't forget dot.

flutter clean
then go to
cd ios
then restart the IDE ..

Open pubspec.yaml,
click on pub_upgrade or type flutter pub upgrade
flutter clean ,
Open the lib/ios folder and delete the
Podfile.lock
and run
pod install
, after building the ios file, run the project of Xcode and everything will be fine.

Related

Swift Compiler Error (Xcode): Concurrency is only available in iOS 15.0.0 or newer

I am trying to run my Flutter app on iOS which use firebase and google map also did all setting related to that but still, when I run it on iOS I get the following error.
Swift Compiler Error (Xcode): Concurrency is only available in iOS 15.0.0 or newer
/Users/rashidali/LubanPoint/ios/Pods/FirebaseStorage/FirebaseStorage/Sources/StorageReference.swift:223:28
here is 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
while the full error looks like that
Failed to build iOS app
Error output from Xcode build:
↳
objc[8137]: Class AppleTypeCRetimerRestoreInfoHelper is implemented in both /usr/lib/libauthinstall.dylib (0x2012f7620) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x104524598). One of the two will be used. Which one is undefined.
objc[8137]: Class AppleTypeCRetimerFirmwareAggregateRequestCreator is implemented in both /usr/lib/libauthinstall.dylib (0x2012f7670) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x1045245e8). One of the two will be used. Which one is undefined.
Xcode's output:
↳
Writing result bundle at path:
/var/folders/8r/j5l1hdxj23n759qd_g_kkfk40000gn/T/flutter_tools.eZhoD4/flutter_ios_build_temp_dirw4qaeH/temporary_xcresult_bundle
/Users/rashidali/FlutterSdk/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-8.3.0/ios/Classes/strategies/PhonePermissionStrategy.m:50:35: warning: 'subscriberCellularProvider' is deprecated: first deprecated in iOS 12.0 [-Wdeprecated-declarations]
CTCarrier *carrier = [netInfo subscriberCellularProvider];
^~~~~~~~~~~~~~~~~~~~~~~~~~
serviceSubscriberCellularProviders
In module 'CoreTelephony' imported from /Users/rashidali/FlutterSdk/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-8.3.0/ios/Classes/strategies/PhonePermissionStrategy.m:8:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.0.sdk/System/Library/Frameworks/CoreTelephony.framework/Headers/CTTelephonyNetworkInfo.h:112:50: note: property 'subscriberCellularProvider' is declared deprecated here
#property(readonly, retain, nullable) CTCarrier *subscriberCellularProvider API_DEPRECATED_WITH_REPLACEMENT("serviceSubscriberCellularProviders", ios(4.0, 12.0)) API_UNAVAILABLE(macos);
Result bundle written to path:
/var/folders/8r/j5l1hdxj23n759qd_g_kkfk40000gn/T/flutter_tools.eZhoD4/flutter_ios_build_temp_dirw4qaeH/temporary_xcresult_bundle
Swift Compiler Error (Xcode): Concurrency is only available in iOS 15.0.0 or newer
/Users/rashidali/LubanPoint/ios/Pods/FirebaseStorage/FirebaseStorage/Sources/StorageReference.swift:223:28
Swift Compiler Error (Xcode): Concurrency is only available in iOS 15.0.0 or newer
/Users/rashidali/LubanPoint/ios/Pods/FirebaseStorage/FirebaseStorage/Sources/StorageReference.swift:292:24
Swift Compiler Error (Xcode): Concurrency is only available in iOS 15.0.0 or newer
/Users/rashidali/LubanPoint/ios/Pods/FirebaseStorage/FirebaseStorage/Sources/StorageReference.swift:376:28
Swift Compiler Error (Xcode): Concurrency is only available in iOS 15.0.0 or newer
/Users/rashidali/LubanPoint/ios/Pods/FirebaseStorage/FirebaseStorage/Sources/StorageReference.swift:406:58
Swift Compiler Error (Xcode): Concurrency is only available in iOS 15.0.0 or newer
/Users/rashidali/LubanPoint/ios/Pods/FirebaseStorage/FirebaseStorage/Sources/StorageReference.swift:440:23
Uncategorized (Xcode): Command CompileSwift failed with a nonzero exit code
Could not build the application for the simulator.
Error launching application on iPhone 13.
Kindly provide solution how to resolve it.
You are targeting iOS 11, we can see it in your podfile:
platform :ios, '11.0'
If you want to use concurrency, async/await calls, you need to change this to iOS 15 as the compiler is suggesting. Also make sure to have XCode 13.2 or newer.

Flutter IOS error: error: no such module 'flutter_config'

I'm having issue when trying to build my flutter project on code magic CI. I'm using Flutter 2.2.3(same issue also happens on 2.8) and Xcode version 12.4(same issue on 13.2)
/Users/builder/clone/ios/Runner/AppDelegate.swift:5:8: error: no such module 'flutter_config'
import flutter_config
^
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
/Users/builder/clone/ios/Runner/AppDelegate.swift:5:8: error: no such module 'flutter_config'
import flutter_config
^
note: Using new build system
note: Planning
note: Build preparation complete
note: Building targets in dependency order
/Users/builder/clone/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.2.99. (in target 'FMDB' from project 'Pods')
Encountered error while building for the device.
When launching the app locally I'm having another error:
ld: warning: Could not find or use auto-linked library 'swift_Concurrency'
ld: warning: Could not find or use auto-linked library 'swiftFileProvider'
ld: warning: Could not find or use auto-linked library 'swiftDataDetection'
ld: warning: Could not find or use auto-linked framework 'AVFAudio'
ld: warning: Could not find or use auto-linked framework 'DataDetection'
Undefined symbols for architecture arm64:
"__swift_FORCE_LOAD_$_swiftDataDetection", referenced from:
__swift_FORCE_LOAD_$_swiftDataDetection_$_FBAudienceNetwork in FBAudienceNetwork(FBAudienceNetwork.o)
(maybe you meant: __swift_FORCE_LOAD_$_swiftDataDetection_$_FBAudienceNetwork)
"_OBJC_CLASS_$_SKAdImpression", referenced from:
objc-class-ref in FBAudienceNetwork(FBAdSKAdNetworkManager.m.o)
"__swift_FORCE_LOAD_$_swiftFileProvider", referenced from:
__swift_FORCE_LOAD_$_swiftFileProvider_$_FBAudienceNetwork in FBAudienceNetwork(FBAudienceNetwork.o)
(maybe you meant: __swift_FORCE_LOAD_$_swiftFileProvider_$_FBAudienceNetwork)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
warning: no rule to process file '/../flutter2/.pub-cache/hosted/pub.dartlang.org/flutter_config-2.0.0/ios/Classes/BuildDotenvConfig.rb' of type 'text.script.ruby' for architecture 'arm64' (in target 'flutter_config' from project 'Pods')
warning: no rule to process file '/../flutter2/.pub-cache/hosted/pub.dartlang.org/flutter_config-2.0.0/ios/Classes/BuildXCConfig.rb' of type 'text.script.ruby' for architecture 'arm64' (in target 'flutter_config' from project 'Pods')
warning: no rule to process file '/../flutter2/.pub-cache/hosted/pub.dartlang.org/flutter_config-2.0.0/ios/Classes/ReadDotEnv.rb' of type 'text.script.ruby' for architecture 'arm64' (in target 'flutter_config' from project 'Pods')
warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'FMDB' from project 'Pods')
warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'Flutter' from project 'Pods')
In your ios/Podfile file, uncomment the platform line and give it a value of 11
# Uncomment this line to define a global platform for your project
platform :ios, '11.0'
Make sure to make the change in your Xcode as well
Then in your ios directory, run the following commands
rm -rf Pods/
rm -rf Podfile.lock
pod install

Flutter application can't running after add firebase_messaging package

Here is the log from vscode
Launching lib/main.dart on iPhone 11 in debug mode...
Running pod install... 3.9s
Running Xcode build...
Xcode build done. 10.3s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
/Users/abdurrohman/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-6.0.16/ios/Classes/FLTFirebaseMessagingPlugin.m:195:43: error: expected a type
- (void)applicationReceivedRemoteMessage:(FIRMessagingRemoteMessage *)remoteMessage {
^
/Users/abdurrohman/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-6.0.16/ios/Classes/FLTFirebaseMessagingPlugin.m:302:53: error: nullability specifier 'nonnull' conflicts with
existing specifier 'nullable'
didReceiveRegistrationToken:(nonnull NSString *)fcmToken {
^
/Users/abdurrohman/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-6.0.16/ios/Classes/FLTFirebaseMessagingPlugin.m:307:24: error: expected a type
didReceiveMessage:(FIRMessagingRemoteMessage *)remoteMessage {
^
/Users/abdurrohman/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-6.0.16/ios/Classes/FLTFirebaseMessagingPlugin.m:141:30: error: property 'shouldEstablishDirectChannel' not
found on object of type 'FIRMessaging *'
[FIRMessaging messaging].shouldEstablishDirectChannel = true;
^
/Users/abdurrohman/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-6.0.16/ios/Classes/FLTFirebaseMessagingPlugin.m:160:21: warning: 'FIRInstanceID' is deprecated: FIRInstanceID
is deprecated, please use FIRInstallations for installation identifier handling and use FIRMessaging for FCM registration token handling. [-Wdeprecated-declarations]
[[FIRInstanceID instanceID]
^
In module 'FirebaseInstanceID' imported from /Users/abdurrohman/bsi/flutter_firebase/ios/Pods/Headers/Public/Firebase/Firebase.h:74:
/Users/abdurrohman/bsi/flutter_firebase/ios/Pods/FirebaseInstanceID/Firebase/InstanceID/Public/FIRInstanceID.h:190:1: note: 'FIRInstanceID' has been explicitly marked deprecated here
__deprecated_msg("FIRInstanceID is deprecated, please use FIRInstallations for installation "
^
In module 'UIKit' imported from /Users/abdurrohman/bsi/flutter_firebase/ios/Pods/Target Support Files/firebase_messaging/firebase_messaging-prefix.pch:2:
In module 'Foundation' imported from
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.3.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:8:
In module 'CoreFoundation' imported from
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation
.h:6:
In module 'Darwin' imported from
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.3.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFo
undation.h:16:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.3.sdk/usr/include/sys/cdefs.h:200:48: note: expanded from macro
'__deprecated_msg'
#define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
^
/Users/abdurrohman/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-6.0.16/ios/Classes/FLTFirebaseMessagingPlugin.m:161:33: warning: 'FIRInstanceIDResult' is deprecated:
FIRInstanceIDResult is deprecated, please use FIRInstallations for app instance identifier handling and use FIRMessaging for FCM registration token handling.
[-Wdeprecated-declarations]
instanceIDWithHandler:^(FIRInstanceIDResult *_Nullable instanceIDResult,
^
In module 'FirebaseInstanceID' imported from /Users/abdurrohman/bsi/flutter_firebase/ios/Pods/Headers/Public/Firebase/Firebase.h:74:
/Users/abdurrohman/bsi/flutter_firebase/ios/Pods/FirebaseInstanceID/Firebase/InstanceID/Public/FIRInstanceID.h:153:1: note: 'FIRInstanceIDResult' has been explicitly marked
deprecated here
__deprecated_msg("FIRInstanceIDResult is deprecated, please use FIRInstallations "
^
In module 'UIKit' imported from /Users/abdurrohman/bsi/flutter_firebase/ios/Pods/Target Support Files/firebase_messaging/firebase_messaging-prefix.pch:2:
In module 'Foundation' imported from
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.3.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:8:
In module 'CoreFoundation' imported from
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation
.h:6:
In module 'Darwin' imported from
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.3.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFo
undation.h:16:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.3.sdk/usr/include/sys/cdefs.h:200:48: note: expanded from macro
'__deprecated_msg'
#define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
^
/Users/abdurrohman/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-6.0.16/ios/Classes/FLTFirebaseMessagingPlugin.m:161:9: warning: 'instanceIDWithHandler:' is deprecated: Use
`Installations.installationID(completion:)` to get the app instance identifier instead. Use `Messaging.token(completion:)` to get FCM registration token instead.
[-Wdeprecated-declarations]
instanceIDWithHandler:^(FIRInstanceIDResult *_Nullable instanceIDResult,
^
In module 'FirebaseInstanceID' imported from /Users/abdurrohman/bsi/flutter_firebase/ios/Pods/Headers/Public/Firebase/Firebase.h:74:
/Users/abdurrohman/bsi/flutter_firebase/ios/Pods/FirebaseInstanceID/Firebase/InstanceID/Public/FIRInstanceID.h:215:5: note: 'instanceIDWithHandler:' has been explicitly marked
deprecated here
__deprecated_msg("Use `Installations.installationID(completion:)` to get the app instance "
^
In module 'UIKit' imported from /Users/abdurrohman/bsi/flutter_firebase/ios/Pods/Target Support Files/firebase_messaging/firebase_messaging-prefix.pch:2:
In module 'Foundation' imported from
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.3.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:8:
In module 'CoreFoundation' imported from
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation
.h:6:
In module 'Darwin' imported from
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.3.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFo
undation.h:16:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.3.sdk/usr/include/sys/cdefs.h:200:48: note: expanded from macro
'__deprecated_msg'
#define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
^
/Users/abdurrohman/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-6.0.16/ios/Classes/FLTFirebaseMessagingPlugin.m:171:21: warning: 'FIRInstanceID' is deprecated: FIRInstanceID
is deprecated, please use FIRInstallations for installation identifier handling and use FIRMessaging for FCM registration token handling. [-Wdeprecated-declarations]
[[FIRInstanceID instanceID] deleteIDWithHandler:^void(NSError *_Nullable error) {
^
In module 'FirebaseInstanceID' imported from /Users/abdurrohman/bsi/flutter_firebase/ios/Pods/Headers/Public/Firebase/Firebase.h:74:
/Users/abdurrohman/bsi/flutter_firebase/ios/Pods/FirebaseInstanceID/Firebase/InstanceID/Public/FIRInstanceID.h:190:1: note: 'FIRInstanceID' has been explicitly marked deprecated here
__deprecated_msg("FIRInstanceID is deprecated, please use FIRInstallations for installation "
^
In module 'UIKit' imported from /Users/abdurrohman/bsi/flutter_firebase/ios/Pods/Target Support Files/firebase_messaging/firebase_messaging-prefix.pch:2:
In module 'Foundation' imported from
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.3.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:8:
In module 'CoreFoundation' imported from
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation
.h:6:
In module 'Darwin' imported from
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.3.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFo
undation.h:16:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.3.sdk/usr/include/sys/cdefs.h:200:48: note: expanded from macro
'__deprecated_msg'
#define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
^
/Users/abdurrohman/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-6.0.16/ios/Classes/FLTFirebaseMessagingPlugin.m:171:33: warning: 'deleteIDWithHandler:' is deprecated: Use
`Installations.delete(completion:)` instead. Also check `Messaging.deleteData(completion:)`if you want to delete FCM registration token. [-Wdeprecated-declarations]
[[FIRInstanceID instanceID] deleteIDWithHandler:^void(NSError *_Nullable error) {
^
In module 'FirebaseInstanceID' imported from /Users/abdurrohman/bsi/flutter_firebase/ios/Pods/Headers/Public/Firebase/Firebase.h:74:
/Users/abdurrohman/bsi/flutter_firebase/ios/Pods/FirebaseInstanceID/Firebase/InstanceID/Public/FIRInstanceID.h:321:33: note: 'deleteIDWithHandler:' has been explicitly marked
deprecated here
__deprecated_msg("Use `Installations.delete(completion:)` instead. "
^
In module 'UIKit' imported from /Users/abdurrohman/bsi/flutter_firebase/ios/Pods/Target Support Files/firebase_messaging/firebase_messaging-prefix.pch:2:
In module 'Foundation' imported from
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.3.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:8:
In module 'CoreFoundation' imported from
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation
.h:6:
In module 'Darwin' imported from
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.3.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFo
undation.h:16:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.3.sdk/usr/include/sys/cdefs.h:200:48: note: expanded from macro
'__deprecated_msg'
#define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
^
/Users/abdurrohman/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-6.0.16/ios/Classes/FLTFirebaseMessagingPlugin.m:196:52: error: property 'appData' not found on object of type
'__strong id'
[self didReceiveRemoteNotification:remoteMessage.appData];
^
/Users/abdurrohman/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-6.0.16/ios/Classes/FLTFirebaseMessagingPlugin.m:308:63: error: property 'appData' not found on object of type
'__strong id'
[_channel invokeMethod:#"onMessage" arguments:remoteMessage.appData];
^
5 warnings and 6 errors generated.
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.3.99. (in target
'FirebaseFirestore' from project 'Pods')
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.3.99. (in target
'firebase_messaging' from project 'Pods')
Could not build the application for the simulator.
Error launching application on iPhone 11.
#SOLVED
References:
https://firebase.flutter.dev/docs/messaging/overview
https://github.com/MaikuB/flutter_local_notifications/issues/1004
I got some error on iOS setup and this is my solved setup on Podfile.
# Uncomment this line to define a global platform for your project
platform :ios, '11.0'
$FirebaseSDKVersion = '8.3.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
When i check on Android, i got some new error again. Some problem come from Firebase initialization on Activity and Application. This is my solved setup on Android.
MainApplication.kt
package id.refactory.flutter_firebase
import android.content.Context
import androidx.multidex.MultiDex
import com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin
import io.flutter.app.FlutterApplication
import io.flutter.plugin.common.PluginRegistry
import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback
import io.flutter.plugins.firebase.messaging.FlutterFirebaseMessagingPlugin
import io.flutter.plugins.firebase.messaging.FlutterFirebaseMessagingBackgroundService;
class MainApplication : FlutterApplication(), PluginRegistrantCallback {
override fun onCreate() {
super.onCreate()
FlutterFirebaseMessagingBackgroundService.setPluginRegistrant(this)
}
override fun attachBaseContext(base: Context) {
super.attachBaseContext(base)
MultiDex.install(this)
}
override fun registerWith(registry: PluginRegistry?) {
FlutterFirebaseMessagingPlugin.registerWith(registry?.registrarFor("io.flutter.plugins.firebase.messaging.FirebaseMessagingPlugin"))
FlutterLocalNotificationsPlugin.registerWith(registry?.registrarFor("com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin"))
}
}
MainActivity.kt
package id.refactory.flutter_firebase
import android.os.Bundle
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugins.GeneratedPluginRegistrant
class MainActivity: FlutterActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
}
override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
GeneratedPluginRegistrant.registerWith(flutterEngine)
}
}
Hope you all guys solve your problem that related with this question.

Flutter ios build error caused from deprecated libraries

I'm using cloud mac server for releasing in ios. And before changing my mac, i succesfully finished build of my ios app, but then i changed my mac server, now when i try to build, getting error below, what can i do to fix this issue, as i understand it's about deprecated libraries, but i can't delete them all because im using them in my app.
/Users/user191346/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_analytics-7.0.1/ios/Classes/FLTFirebaseAnalytic
sPlugin.m:49:19: warning: 'setScreenName:screenClass:' is deprecated: Use +[FIRAnalytics logEventWithName:kFIREventScreenView
parameters:] instead. [-Wdeprecated-declarations]
[FIRAnalytics setScreenName:screenName screenClass:screenClassOverride];
^
In module 'FirebaseAnalytics' imported from
/Users/user191346/Desktop/rate_prof/rate_prof/ios/Pods/Headers/Public/Firebase/Firebase.h:22:
/Users/user191346/Desktop/rate_prof/rate_prof/ios/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRAnal
ytics.h:128:5: note: 'setScreenName:screenClass:' has been explicitly marked deprecated here
DEPRECATED_MSG_ATTRIBUTE(
^
In module 'UIKit' imported from /Users/user191346/Desktop/rate_prof/rate_prof/ios/Pods/Target Support
Files/firebase_analytics/firebase_analytics-prefix.pch:2:
In module 'Foundation' imported from
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.4.sdk/System/Library/Framework
s/UIKit.framework/Headers/UIKit.h:8:
In module 'CoreFoundation' imported from
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.4.sdk/System/Library/Framework
s/Foundation.framework/Headers/Foundation.h:6:
In module 'Darwin' imported from
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.4.sdk/System/Library/Framework
s/CoreFoundation.framework/Headers/CoreFoundation.h:16:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.4.sdk/usr/include/Availability
Macros.h:183:64: note: expanded from macro 'DEPRECATED_MSG_ATTRIBUTE'
#define DEPRECATED_MSG_ATTRIBUTE(s) __attribute__((deprecated(s)))
^
1 warning generated.
/Users/user191346/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_analytics-7.0.1/ios/Classes/FLTFirebaseAnalytic
sPlugin.m:49:19: warning: 'setScreenName:screenClass:' is deprecated: Use +[FIRAnalytics logEventWithName:kFIREventScreenView
parameters:] instead. [-Wdeprecated-declarations]
[FIRAnalytics setScreenName:screenName screenClass:screenClassOverride];
^
In module 'FirebaseAnalytics' imported from
/Users/user191346/Desktop/rate_prof/rate_prof/ios/Pods/Headers/Public/Firebase/Firebase.h:22:
/Users/user191346/Desktop/rate_prof/rate_prof/ios/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRAnal
ytics.h:128:5: note: 'setScreenName:screenClass:' has been explicitly marked deprecated here
DEPRECATED_MSG_ATTRIBUTE(
^
In module 'UIKit' imported from /Users/user191346/Desktop/rate_prof/rate_prof/ios/Pods/Target Support
Files/firebase_analytics/firebase_analytics-prefix.pch:2:
In module 'Foundation' imported from
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.4.sdk/System/Library/Framework
s/UIKit.framework/Headers/UIKit.h:8:
In module 'CoreFoundation' imported from
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.4.sdk/System/Library/Framework
s/Foundation.framework/Headers/Foundation.h:6:
In module 'Darwin' imported from
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.4.sdk/System/Library/Framework
s/CoreFoundation.framework/Headers/CoreFoundation.h:16:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.4.sdk/usr/include/Availability
Macros.h:183:64: note: expanded from macro 'DEPRECATED_MSG_ATTRIBUTE'
#define DEPRECATED_MSG_ATTRIBUTE(s) __attribute__((deprecated(s)))
^
1 warning generated.
building file list ... rsync: link_stat "/Users/user191346/Desktop/rate_prof/rate_prof/ios/Flutter/App.framework" failed: No
such file or directory (2)
done
You needn't delete these packages, just follow these
commands and try in your terminal;
First Method for fix the issue:
flutter clean
flutter pub get
flutter run
if isn't work you can try this:
Second Solution:
flutter pub get
cd ios
pod install
Or you can remove Podfile.lock and after try this:
cd ios
pod install

Creating unit tests for Xcode project results in error : Showing Recent Messages :-1: Undefined symbol: _OBJC_CLASS_$_FBSDKCodelessIndexer

When adding this to my pods file ( for unit testing purposes )
target 'MY_PROJECT_TITLE_Tests' do
inherit! :search_paths
pod 'Firebase'
end
I get the error when compiling:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_FBSDKCodelessIndexer", referenced from:
objc-class-ref in FBSDKMarketingKit(FBSDKButtonIndexer.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
there were no errors prior to the "pod install" of the above podfile change. Why is this / is there a fix? thank you.
Likely a pod update is needed.
There could be an incompatibility between old versions of Firebase and FBSDK like How to fix build error with FBSDKLoginKit in Xcode

Resources