XCode9和10编译Cordova报错toLowerCase of undefined解决方案

Posted oliverreal

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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);
}
}

以上是关于XCode9和10编译Cordova报错toLowerCase of undefined解决方案的主要内容,如果未能解决你的问题,请参考以下文章