Ionic iOS build fails, error archive not found
Solution 1:
Currently cordova-ios is not compatible with Xcode 10
You can try to disable the new build system that Xcode 10 uses and use the old one by adding this to your build.json file
"buildFlag": [
"-UseModernBuildSystem=0"
]
or adding --buildFlag="-UseModernBuildSystem=0"
to the build command
The full command should be cordova build ios --buildFlag="-UseModernBuildSystem=0"
.
Or for Ionic ionic cordova build ios -- --buildFlag="-UseModernBuildSystem=0"
Solution 2:
In addition to the answer given by jcesarmobile, another solution is to build the app with the Ionic CLI by executing the following command:
ionic cordova build ios -- --buildFlag="-UseModernBuildSystem=0"
According to the documentation of the ionic build
command, to pass additional options to the Cordova CLI, you should use the --
separator after the Ionic CLI arguments. The execution of the build
command through Ionic CLI instead of Cordova CLI will also build web assets and provide friendly checks before Cordova merely builds the app.
Solution 3:
An example for a working build.json file (to place into your Cordova / Ionic project root directory) is the following content:
{
"ios": {
"debug": {
"buildFlag": [
"-UseModernBuildSystem=0"
]
},
"release": {
"buildFlag": [
"-UseModernBuildSystem=0"
]
}
}
}
For more parameters about file build.json, see also the Cordova documentation: iOS Platform Guide
Solution 4:
The command suggested by jcesarmobile didn't work for me, but doing
cordova build ios --buildFlag="-UseModernBuildSystem=0"
(without ionic) succesfully completed the build.
After that I've been able to do ionic cordova build ios without any problems. (even without the buildFlag). I'm not an expert in this, in fact it was a mistake not to include ionic lol. So, although everything seems to work ok i'm not sure if there are any drawbacks in building with only cordova for the first time. Maybe someone can throw some light in the comments
Solution 5:
A couple of pitfalls: Preparing the Xcode file.
It’s time to prepare the project to be opened in Xcode. However, Ionic-Cordova doesn’t support the new build system of Xcode. So the project has to be prepared for the legacy build system. Pitfall #2.
Important! Disconnect your iPhone or iPad device connected to the Mac or the following command won’t work!!! Pitfall #3.
ionic cordova build ios --prod --buildFlag='-UseModernBuildSystem=0'
Congratulations! Your MyApp.xcodeproj (etc.) file is ready. You’re almost half way to have an IPA uploaded. Just double click on the Myapp.xcodeproj file or open it through Xcode.
There are several other pitfalls you will find:
- It’s a common pitfall #4 to not have the proper privilege set. In particular the rol “Developer” (pitfall #4.1) doesn’t have privileges to push apps to the Store
- Double check that the “Bundle Identifier” is exactly the one you set in the config.xml file!
- Xcode exposes a signing bug, pitfall #5, so untick the “Automatically manage signing” and tick again. You will face this bug for sure.
Xcode bugs and Cordova not supporting properly the new building system leads to all these issues. I made a full guide showing how to fix them after lurking hours.