Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode device list is empty in ionic/cordova project

No matter what I try I can't get access to the Xcode simulators from my ionic/cordova project. Xcode Command Line Tool is installed.

cordova run ios --list

returns

Available ios devices:

Available ios virtual devices:

ionic cordova emulate ios --list

returns

Available ios virtual devices:

I have all the simulators in Xcode and it's working fine when Im opening the project in Xcode and run the simulators manually.

The consequences of this is that I cant run my app with livereload from the terminal:

ionic cordova emulate --livereload ios -- --buildFlag="-UseModernBuildSystem=0" --target="iPhone-X, 12.1"

returns

Device id for device name "iPhone X" and runtime "iOS 12.1" could not be found, or is not available.

enter image description here

like image 263
Christoffer Avatar asked Jan 02 '23 06:01

Christoffer


1 Answers

This is a bug related to the new version of XCode. I had the same problem. I would advise you to uninstall and reinstall XCode but I don't think it will work.

I solved (dirty fix) my problem by applying what ejerskov says here: https://github.com/ios-control/ios-sim/issues/246

On platforms/ios/cordova/node_modules/ios-sim/src/lib.js

I have changed

available_runtimes[ runtime.name ] = (runtime.availability === '(available)');

to

available_runtimes[ runtime.identifier ] = (runtime.availability === '(available)');

Otherwise I think we should wait for a new release of ios-sim and cordova-ios...

like image 140
Gwen Avatar answered Jan 03 '23 19:01

Gwen