Trouble with XCode 10 and Cordova Apps
Attention Cordova, Phonegap and ionicframework developers! This quick tip might save a couple of headaches and lost development time. A few days ago, Apple launched XCode 10, an upgrade with many new features and improvements. However, with that update, there was a change that’s causing trouble in the current Cordova build process.
XCode 10 now uses a new default build process, called “Modern Build System”, previously available on an opt-in basis until Xcode 9. The new build system provides improved reliability and build performance, and it catches project configuration problems that the legacy build system does not.
However, Cordova build process doesn’t use this new process yet, as the current cordova-ios project structure is not compatible with this new build system. In other words, the new “default” builder configuration triggers errors and prevents IPA files from being generated.
Although the Cordova development does not claim to support Xcode 10, they are actively working to solve this problem.
Making it work
The legacy build system is still available in Xcode 10. To use the legacy build system while building Cordova/Phonegap applications, developers can add the following build flag to the command line:
Currently, the best workaround is to opt-out of the new build system adding this build flag to the command line. For instance, if you want to run your iOS app from the command line, you can add –buildFlag=”-UseModernBuildSystem=0″ to make it work as expected.
# Cordova CLI
cordova run ios --buildFlag='-UseModernBuildSystem=0'
cordova build ios --buildFlag='-UseModernBuildSystem=0'
# Ionic CLI
ionic cordova run ios --buildFlag="-UseModernBuildSystem=0"
ionic cordova build ios --buildFlag="-UseModernBuildSystem=0"
If you user a build.json config file to store build configuration details, you can add the following under the iOS release, as follows:
Likewise, if you want to test your App using one of the emulators, you also need to add the same build flag:
cordova run --target='iPad-Air-2' --buildFlag='-UseModernBuildSystem=0'
The official announcement about this problem can be found on a post on Apache’s GitHub repo page.