我使用 ionic3 和 cordova@8.1.2。最近我的 Xcode 更新到 11.1 并发生错误 [无法读取未定义的属性 'toLowerCase']。我尝试了这种方式:更改:
if (device.name === deviceType.name.replace(/\-inch/g, ' inch') &&
device.availability.toLowerCase().indexOf('unavailable') < 0) {
availAcc.push(device);
}
Run Code Online (Sandbox Code Playgroud)
到:
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);
}
}
Run Code Online (Sandbox Code Playgroud)
然后错误发生在
Cannot read property 'name' of undefined
Run Code Online (Sandbox Code Playgroud)
我找不到这个“名字”在哪里。