最近跟新了xcode后,发现使用cordova项目打包app是出现了下面错误
Cannot read property ‘toLowerCase’ of undefined
在网上找了许久才找到解决方案,结果!!! 有出现了Cannot read property ''name" of undefined 的报错,你他…,调试和查找许久,终于找到了问题所在和解决方案,现在记下来做个记录
1. Cannot read property ‘toLowerCase’ of undefined
报错位置://platforms/ios/cordova/lib/list-emulator-build-targets 第54行的device.availability.toLowerCase()
修改:
将
if (device.name === deviceType.name.replace(/\-inch/g, ' inch') &&
device.availability.toLowerCase().indexOf('unavailable') < 0) {
availAcc.push(device);
}
改为:
if (device.name === deviceType.name || device.name === deviceType.name.replace(/\-inch/g, ' inch')) {
// Check new flag isAvailable (XCode 10