apache/cordova-ios

Cannot read property 'name' of undefined xcode@15 ios17

LOVETOO opened this issue · 2 comments

sudo ionic cordova build ios --prod --release
...
Cannot read property 'name' of undefined.
at /xxx/platforms/ios/cordova/lib/build.js:162:40

return getDefaultSimulatorTarget().then(function (defaultTarget) {
emulatorTarget = defaultTarget.name;

The defaultTarget is undefined.
Running getDefaultSimulatorTarget using sudo yields undefined, while the opposite is true.

The iOS simulator is installed through commands:
sudo xcode-select -s /Applications/Xcode-15.0.app
sudo xcodebuild -runFirstLaunch
sudo xcrun simctl runtime add "/Users/xxx/Desktop/xxx/iOS_17_Simulator_Runtime.dmg"

Environment:
Mac OS 14.0
xCode 15.0
iOS simulator 17.0
ionic/cli@7.4.3
Cordova 12.0.0

nodejs:16.x

Why are you running as root? Running things as root puts your development machine at risk. Cordova should run without requiring root If Cordova requires root, it might mean you installed it using root so that you're normal user doesn't have permission to read or execute files.

Running simctl under root shows me it has no devices either on my mac machine other than an iPhone 13 /iOS 15.5 and an iPod Touch / iOS 15.5 device (which is kind of odd in itself.) Running simctl under your own user shows all the simulators you'd expect to have. So I this doesn't appear to be a bug with Cordova, but rather with XCode.

You can test this yourself using: xcrun simctl list

sudo xcrun simctl runtime add "/Users/xxx/Desktop/xxx/iOS_17_Simulator_Runtime.dmg"

XCode 15 also ships with iOS 17 runtime + simulators. You don't need to add one yourself.