小编liq*_*qin的帖子

cordova 构建 ios,但“无法读取未定义的属性 'toLowerCase'”中的错误

我使用 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)

我找不到这个“名字”在哪里。

cordova xcode11

2
推荐指数
1
解决办法
4370
查看次数

标签 统计

cordova ×1

xcode11 ×1