最近跟新了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.1+) or legacy string availability (XCode 10 and lower)
if (device.isAvailable || (device.availability && device.availability.toLo

在更新Xcode后,使用Cordova打包APP时遇到Cannot read property 'toLowerCase'及'name' of undefined的错误。通过定位错误源,分别在/platforms/ios/cordova/lib/list-emulator-build-targets的device.availability.toLowerCase()和/platforms/ios/cordova/lib/build.js的device.isAvailable处进行代码修正,解决了打包问题。
最低0.47元/天 解锁文章
764

被折叠的 条评论
为什么被折叠?



