The app launches on Android normally even when adding Firebase, But not on iOS.
my Pod file:
# Uncomment this line to define a global platform for your project
platform :ios, '14.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__))
$FirebaseSDKVersion='10.23.0'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
# e.g. when you don't need camera permission, just add 'PERMISSION_CAMERA=0'
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'
]
config.build_settings['ENABLE_BITCODE'] = 'NO'
end
end
end
I have tried several solutions but none of them worked, I also updated Xcode to 15.3 and iOS to 17.4, but this does not fix the issue.
Error:
Launching lib/main.dart on iPhone 15 Pro Max in debug mode...
Xcode build done. 454.1s
Failed to build iOS app
Error output from Xcode build:
↳
--- xcodebuild: WARNING: Using the first of multiple matching destinations:
2
{ platform:iOS Simulator, id:08659800-D559-478A-8931-B251851D0BC5, OS:17.4, name:iPhone 15 Pro Max }
** BUILD FAILED **
2
Xcode's output:
↳
Writing result bundle at path:
/var/folders/hp/cymv76nj76s6vwvm72j96gw00000gn/T/flutter_tools.JsDFZz/flutter_ios_build_temp_dir0AdLcc/temporary_xcresult_bundle
/Users/yassine/Documents/ExploreVo/Mobile app/user app/latest/exolorevo-user/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 17.4.99. (in target 'FirebaseAuth-FirebaseAuth_Privacy' from project 'Pods')
/Users/yassine/Documents/ExploreVo/Mobile app/user app/latest/exolorevo-user/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 17.4.99. (in target 'FirebaseMessaging-FirebaseMessaging_Privacy' from project 'Pods')
/Users/yassine/Documents/ExploreVo/Mobile app/user app/latest/exolorevo-user/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 17.4.99. (in target 'FirebaseCrashlytics-FirebaseCrashlytics_Privacy' from project 'Pods')
/Users/yassine/Documents/ExploreVo/Mobile app/user app/latest/exolorevo-user/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 10.0, but the range of supported deployment target versions is 12.0 to 17.4.99. (in target 'gRPC-C++-grpcpp' from project 'Pods')
/Users/yassine/Documents/ExploreVo/Mobile app/user app/latest/exolorevo-user/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 10.0, but the range of supported deployment target versions is 12.0 to 17.4.99. (in target 'gRPC-C++-gRPCCertificates-Cpp' from project 'Pods')
/Users/yassine/Documents/ExploreVo/Mobile app/user app/latest/exolorevo-user/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 10.0, but the range of supported deployment target versions is 12.0 to 17.4.99. (in target 'gRPC-C++' from project 'Pods')
warning: Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'gRPC-C++' from project 'Pods')
/Users/yassine/Documents/ExploreVo/Mobile app/user app/latest/exolorevo-user/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 17.4.99. (in target 'FirebaseFirestore' from project 'Pods')
/Users/yassine/Documents/ExploreVo/Mobile app/user app/latest/exolorevo-user/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 17.4.99. (in target 'FirebaseFirestoreInternal' from project 'Pods')
/Users/yassine/Documents/ExploreVo/Mobile app/user app/latest/exolorevo-user/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 17.4.99. (in target 'FirebaseFirestoreInternal-FirebaseFirestoreInternal_Privacy' from project 'Pods')
/Users/yassine/Documents/ExploreVo/Mobile app/user app/latest/exolorevo-user/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 17.4.99. (in target 'FirebaseFirestore-FirebaseFirestore_Privacy' from project 'Pods')
note: Run script build phase 'Run Script' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'Runner' from project 'Runner')
note: Run script build phase 'Thin Binary' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'Runner' from project 'Runner')
warning: Run script build phase 'FlutterFire: "flutterfire upload-crashlytics-symbols"' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Runner' from project 'Runner')
/Users/yassine/Documents/ExploreVo/Mobile app/user app/latest/exolorevo-user/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 17.4.99. (in target 'Firebase' from project 'Pods')
Could not build the application for the simulator.
Error launching application on iPhone 15 Pro Max.
I have tried all the solution here
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '17.0'
end
end
end
but that gives another issue which is:
Launching lib/main.dart on iPhone 15 Pro Max in debug mode...
Xcode build done. 17.8s
Failed to build iOS app
Swift Compiler Error (Xcode): 'Flutter/Flutter.h' file not found
/Users/yassine/.pub-cache/hosted/pub.dev/nb_utils-7.0.2/ios/Classes/NbUtilsPlugin.h:0:8
Swift Compiler Error (Xcode): Could not build Objective-C module 'nb_utils'
Swift Compiler Error (Xcode): No such module 'Flutter'
/Users/yassine/.pub-cache/hosted/pub.dev/shared_preferences_foundation-2.3.5/darwin/Classes/messages.g.swift:9:9
messages.g.swift:9
Could not build the application for the simulator.
Error launching application on iPhone 15 Pro Max.
Any idea on how to solve it? It is been two days on this!
2
Answers
Got it Solved!
I was using Firebase CLI to link the app with Firebase which adds
firebase_options.dart
, but the project does not work that way( it's old and does not usefirebase_options.dart
). so downloadinggoogle-service.json
andGoogleService-Info.plist
worked fine.I think you have to add firebase options into main dart
which is specifies individual credentials for each platform
For Information take visit of this link
Firebase Docs