Launching lib/main.dart on iPhone 13 in debug mode...
lib/main.dart:1
Xcode build done. 4.9s
Failed to build iOS app
Error output from Xcode build:
↳
objc[50120]: Class AMSupportURLConnectionDelegate is implemented in both /usr/lib/libauthinstall.dylib (0x2060d2b90) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x1045ec2c8). One of the two will be used. Which one is undefined.
objc[50120]: Class AMSupportURLSession is implemented in both /usr/lib/libauthinstall.dylib (0x2060d2be0) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x1045ec318). One of the two will be used. Which one is undefined.
xcodebuild: error: Could not resolve package dependencies:
failed extracting 'https://dl.google.com/firebase/ios/swiftpm/8.12.0/GoogleAppMeasurement.zip' which is required by binary target 'GoogleAppMeasurement': /Users/austin/Library/Developer/Xcode/DerivedData/Runner-euwderdqhwothxfbyyaosgbxnztk/SourcePackages/artifacts/extract/GoogleAppMeasurement is not a directory
fatalError
Could not build the application for the simulator.
Error launching application on iPhone 13.
Exited (sigterm)
I'm getting this error trying to build to iOS on an M1 Mac. How do I fix this? I have firebase on it and it works fine on android.
CodePudding user response:
There are many things that could have gone wrong in this process. Here are some tips for you to diagnose and find the issue:
- build your iOS project from scratch using
flutter clean ios
followed byflutter pub get
. The output of the first command will look like this:
Cleaning Xcode workspace... 1,755ms
Deleting build... 16ms
Deleting .dart_tool... 2ms
Deleting .packages... 0ms
Deleting Generated.xcconfig... 0ms
Deleting flutter_export_environment.sh... 0ms
And the second command's output will look like this:
Running "flutter pub get" in testingisolates... 814ms
The flutter clean ios
will effectively do a cleanup of your iOS project for you and will set things up from scratch, including your dependencies' structure. That's why you will need to run flutter pub get
in order to reconstruct your dependencies.
The other approach would be to open your
Runner.xcworkspace
workspace inside theios/
folder using Xcode and then do a clean and run the app using Xcode on your designated iOS simulator and observe the results. Is it giving you the same problem there?Another approach, in case you have Cocoapods dependencies, is that you may want to do is to use
pod deintegrate
. You can installpod deintegrate
using this command:
[sudo] gem install cocoapods-deintegrate
After installing it, you can simply, inside the /ios
folder of your project, run:
cd ios
➜ ios pod deintegrate
Deintegrating `Runner.xcodeproj`
Removing `Pods` directory.
Project has been deintegrated. No traces of CocoaPods left in project.
Note: The workspace referencing the Pods project still remains.
and the output will be as shown above. After doing this you will need to reinstall your pods and before doing that I suggest that you remove your Podfile.lock as well like so:
rm Podfile.lock && pod install
This should reinstall your pod dependencies for you. After doing this, I suggest that you try running your app again with either Xcode directly or from Visual Studio Code or Android Studio to see if it works.
CodePudding user response:
Turns out this was an issue I had with Firebase. I removed all Firebase stuff and tried again following a tutorial and it worked.