XCode9和10编译Cordova报错toLowerCase of undefined解决方案
XCode升级到9或10后,cordova build时报错:toLowerCase of undefined...
解决方案:
修改platforms/ios/cordova/lib/list-emulator-build-targets文件第53行左右。原来的代码:
if (device.name === deviceType.name.replace(/\-inch/g, ' inch') &&
device.availability.toLowerCase().indexOf('unavailable') < 0) {
availAcc.push(device);
}
修改为:
if (device.name === deviceType.name.replace(/\-inch/g, ' inch')) {
if ((device.availability && device.availability.toLowerCase().indexOf('unavailable') < 0)
|| device.isAvailable == 'YES') {
// XCode 10 and lower
availAcc.push(device);
}
}