You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description:
It appears that the latest version of XCode builds the app to a different folder (my version is 14.3.1). This causes an error when you run ionic cordova run ios because native-run is given the wrong path.
The command executed and error:
> native-run ios --app platforms/ios/build/device/Zimmo.ipa --device
[native-run] ERR_UNKNOWN: Path 'platforms/ios/build/device/Zimmo.ipa' not found
[ERROR] An error occurred while running subprocess native-run.
However, my app is now in platforms/ios/build/Debug-iphoneos folder. This works:
For those are still annoyed by this issue, I'm using ios after_build hook to overcome this for time being. Here goes the hooking script which could be a temporary solution.
constfs=require('node:fs');constfsExtra=require('fs-extra');constpath=require('node:path');const{ findXCodeProjectIn }=require('cordova-ios/lib/build');module.exports=async({ opts })=>{const{ device, projectRoot, release, options }=opts;// Pragmatically this fix is required only for emulationif(!options.emulator){return;}constprojectPath=path.join(projectRoot,'platforms/ios');constappName=awaitfindXCodeProjectIn(projectPath);constbinaryName=`${appName}.app`;// Mimic cordova (Ref: node_modules/cordova-ios/lib/build.js#218)constconfiguration=release ? 'Release' : 'Debug';constappPath=path.join(projectPath,'build',`${configuration}-${device ? 'iphoneos' : 'iphonesimulator'}`,binaryName);// @ionic/[email protected] expectation (lib/integrations/cordova/project.js#13)constionicIosSimulatorPackagePath='platforms/ios/build/emulator';constionicIosDevicePackagePath='platforms/ios/build/device';constionicIosBuildPath=path.join(projectRoot,device ? ionicIosDevicePackagePath : ionicIosSimulatorPackagePath);awaitfs.promises.mkdir(ionicIosBuildPath,{recursive: true});constionicBinaryPath=path.join(ionicIosBuildPath,binaryName);awaitfsExtra.copy(appPath,ionicBinaryPath);};
Description:
It appears that the latest version of XCode builds the app to a different folder (my version is 14.3.1). This causes an error when you run
ionic cordova run ios
becausenative-run
is given the wrong path.The command executed and error:
However, my app is now in
platforms/ios/build/Debug-iphoneos
folder. This works:Steps to Reproduce:
ionic cordova run ios --device
Output:
[native-run] ERR_UNKNOWN: Path 'platforms/ios/build/device/Zimmo.ipa' not found
[ERROR] An error occurred while running subprocess native-run.
My
ionic info
:Other Information:
I guess the problem is caused here:
https://github.com/ionic-team/ionic-cli/blob/develop/packages/%40ionic/cli/src/lib/integrations/cordova/project.ts#L15
I'm not sure if this can just be changed, this may need to become an array for backwards compatibility ? I can create a PR for this if you like.
The text was updated successfully, but these errors were encountered: