I’m trying to start a Flutter project I have gotten on a iOS Simulator and the problem is I can’t. On another Mac, my friend was able to start it but I have been running in circles… I have tried:
**
- Product > Clean Build Folder
- deleted Pod folder and PodFile.lock and pod repo update – pod install
- Erase all content and settings in the iOS Simulator
- flutter clean, flutter pub get
- inside the podfile :config.build_settings[‘IPHONEOS_DEPLOYMENT_TARGET’] = ‘15.0’ // or to any target for that matter
Podfile:
# Uncomment this line to define a global platform for your project
platform :ios, '15.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
# pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '10.3.0'
use_frameworks!
use_modular_headers!
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
post_install do |installer|
installer.aggregate_targets.each do |target|
target.xcconfigs.each do |variant, xcconfig|
xcconfig_path = target.client_root + target.xcconfig_relative_path(variant)
IO.write(xcconfig_path, IO.read(xcconfig_path).gsub("DT_TOOLCHAIN_DIR", "TOOLCHAIN_DIR"))
end
end
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
if config.base_configuration_reference.is_a? Xcodeproj::Project::Object::PBXFileReference
xcconfig_path = config.base_configuration_reference.real_path
IO.write(xcconfig_path, IO.read(xcconfig_path).gsub("DT_TOOLCHAIN_DIR", "TOOLCHAIN_DIR"))
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
target.build_configurations.each do |config|
config.build_settings['OTHER_SWIFT_FLAGS'] ||= ['$(inherited)']
#config.build_settings['OTHER_SWIFT_FLAGS'] << '-D BYPASS_PERMISSION_NOTIFICATIONS'
#config.build_settings['OTHER_SWIFT_FLAGS'] << '-D BYPASS_PERMISSION_IOSADDTOPHOTOLIBRARY'
#config.build_settings['OTHER_SWIFT_FLAGS'] << '-D BYPASS_PERMISSION_IOSCHANGEPHOTOLIBRARY'
end
end
end
I have tried this in different orders and still no use. The errors (I haven’t put them all since they are huge) are:
Failed to build iOS app
Error output from Xcode build:
↳
--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:iOS Simulator, id:559C4BFF-EDD7-47C0-BBF0-23EFA0F09B49, OS:17.5, name:iPhone 15 Pro Max }
{ platform:iOS Simulator, id:559C4BFF-EDD7-47C0-BBF0-23EFA0F09B49, OS:17.5, name:iPhone 15 Pro Max }
** BUILD FAILED **
Xcode's output:
↳
Writing result bundle at path:
/var/folders/zy/s6zpmk8x1sz8rh2r5f6cf0040000gn/T/flutter_tools.LUGgCm/flutter_ios_build_temp_dirp82spW/temporary_xcresult_bundle
ld: warning: ignoring duplicate libraries: '-lc++'
ld: warning: ignoring duplicate libraries: '-lc++'
ld: warning: ignoring duplicate libraries: '-lc++'
ld: warning: ignoring duplicate libraries: '-lc++'
/Users/user/Downloads/app-flavors/ios/Runner/AppDelegate.swift:34:29: warning: 'alert' was deprecated in iOS 14.0
completionHandler([.alert, .sound])
^
/Users/user/Library/Developer/Xcode/DerivedData/Runner-gbukoovcjoxwzreoddwxmohrumea/Build/Intermediates.noindex/Runner.build/Debug-dev-iphonesimulator/Runner.build/Script-486182A2307E10650A730B9F.sh: line 5: flutterfire: command not found
Command PhaseScriptExecution failed with a nonzero exit code
/Users/user/Downloads/app-flavors/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.5.99. (in target 'wakelock_plus-thermal' from project 'Pods')
/Users/user/Downloads/app-flavors/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 12.0 to 17.5.99. (in target 'permission_handler_apple-permission_handler_apple_privacy' from project 'Pods')
/Users/user/Downloads/app-flavors/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 12.0 to 17.5.99. (in target 'nanopb-nanopb_Privacy' from project 'Pods')
/Users/user/Downloads/app-flavors/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 12.0 to 17.5.99. (in target 'libwebp' from project 'Pods')
/Users/user/Downloads/app-flavors/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.5.99. (in target 'leveldb-library-leveldb_Privacy' from project 'Pods')
/Users/user/Downloads/app-flavors/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 12.0 to 17.5.99. (in target 'flutter_local_notifications-flutter_local_notifications_privacy' from project 'Pods')
etc...
I’m not sure what is the problem… Can the problem be the cocoapods or the PATHs ~/.zshrc files?
export PATH="/opt/homebrew/bin:$PATH"
export PATH="$PATH:/user/local/opt/flutter/bin"
export PATH="$PATH:$HOME/.pub-cache/bin"
export PATH="/opt/homebrew/Caskroom/flutter/3.22.2/flutter/bin:$PATH"
in the My flutter doctor -v is without issues. Any form of help is greatly needed and appreciated.
Open your project in Xcode.
Check your Flutter SDK path and project path
4
I think main issue is this string from log:
line 5: flutterfire: command not found
Looks like your project uses firebase, which requires some additional configuration of your development environment. I recommend you to follow these instructions: https://firebase.google.com/docs/flutter/setup?platform=ios
This particular issue with flutterfire
can be resolved with this step
Also, make sure that dart packages are in your path, here is documentation for this
Sameri11 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
I got the same error a few months ago, and I am trying to remove and reinstall Cocoapods and it works.
From the error message, Have you been using any 3rd party packages?
You can try to set the Deployment target for your Pods references with the following command:
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
end
end
end
or remove the value:
Code Block
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
Hopely this can help you to fix the issue 🙂
Allian Kazi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.