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

liq*_*qin 2 cordova xcode11

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

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

Ram*_*vam 6

删除平台 ios 并再次添加平台 ios。
它为我自己工作。

cordova platform rm ios
cordova platform add ios
Run Code Online (Sandbox Code Playgroud)