I have a Ionic Cordova application I've been working on. Recently I upgraded the cordova toolchain and now while trying to run the app on an ios emulator, it leads to an error in native-run after the build succeeds.
The verbose logs for ionic cordova run ios --emulator look like this:
...<build logs trimmed>...
.
.
.
Touch /Volumes/Data/ionicprojects/MyApp/platforms/ios/build/Debug-iphonesimulator/MyApp.app (in target 'MyApp' from project 'MyApp')
cd /Volumes/Data/ionicprojects/MyApp/platforms/ios
/usr/bin/touch -c /Volumes/Data/ionicprojects/MyApp/platforms/ios/build/Debug-iphonesimulator/MyApp.app
** BUILD SUCCEEDED **
No scripts found for hook "after_compile".
No scripts found for hook "after_build".
> native-run ios --app "platforms/ios/build/emulator/MyApp.app" --virtual --verbose
[native-run] 2023-09-25T04:38:49.424Z native-run Caught fatal error: IOSRunException [Error]: Path 'platforms/ios/build/emulator/MyApp.app' not found
[native-run] at Object.run (/Volumes/Data/ionicprojects/MyApp/node_modules/native-run/dist/ios/run.js:83:15)
[native-run] at Object.run (/Volumes/Data/ionicprojects/MyApp/node_modules/native-run/dist/ios/index.js:15:15)
[native-run] at async Object.run (/Volumes/Data/ionicprojects/MyApp/node_modules/native-run/dist/index.js:24:13) {
[native-run] code: undefined,
[native-run] exitCode: 1,
[native-run] data: undefined
[native-run] }
[native-run] ERR_UNKNOWN: Path 'platforms/ios/build/emulator/MyApp.app' not found
[ERROR] An error occurred while running subprocess native-run.
native-run ios --app "platforms/ios/build/emulator/MyApp.a... exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
ionic:utils-process onBeforeExit handler: 'process.exit' received +0ms
ionic:utils-process onBeforeExit handler: running 5 functions +0ms
ionic:lib:hooks Looking for ionic:serve:after npm script. +2m
ionic:utils-process processExit: exiting (exit code: 1) +73ms
Note that running native-run ios --app "platforms/ios/build/Debug-iphonesimulator/MyApp.app" --virtual --verbose at this point successfully deploys the app onto a simulator.
Looking through the cordova-ios change logs, it seems that default CONFIGURATION_BUILD_DIR overrides were removed, however I cannot figure out how to go about migrating from this regression or any other breaking changes that might've affected me.
Thats because cordova-ios7 change -> https://cordova.apache.org/announcements/2023/07/10/cordova-ios-7.0.0.html
To fix the problem since cordova fix the script, from your ionic project path :