iOS: Cannot read property 'toLowerCase' of undefined

Hi, after the last Xcode Update my app worked and I wanted to not only use the emulator. So I tried to test it with my real phone and it worked as well.
But now I’m getting this error:

Reading build config file:
Cannot read property 'toLowerCase' of undefined

With this solution:
change the “if” line 54 of platforms/ios/cordova/lib/list-emulator-build-targets for:
if (device.name === deviceType.name.replace(/\-inch/g, ' inch') && device.isAvailable == 'YES')
https://github.com/apache/cordova-ios/issues/427#issuecomment-431862412

from here:

I now get

Reading build config file:
Cannot read property 'name' of undefined

Both errors are stopping me like a big wall^^
Is maybe a new installation of Xcode bringing back a clean ground?

Ionic info:

Ionic:

   Ionic CLI          : 5.4.2 (/usr/local/lib/node_modules/ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.2.4

Cordova:

   Cordova CLI       : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms : ios 4.4.0
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 3.1.2, (and 17 other plugins)

Utility:

   cordova-res : not installed
   native-run  : 0.2.8 

System:

   ios-deploy : 1.9.2
   NodeJS     : v10.16.3 (/usr/local/bin/node)
   npm        : 6.10.2
   OS         : macOS Mojave
   Xcode      : Xcode 11.1 Build version 11A1027
1 Like

I have the exact same issue but in a v4 project.

I also tried to create a new ionic app and there is no problem.
So Xcode should work fine and as expected.
Unfortunately I changed nothing in my code and there errors over errors ;-(

I also have the same issue after updating my XCode to the latest. It was working but after a few days without touching it I cannot build with iOS Anymore. I am able to build an android project.

Hope someone here could help us.

After a lot of trying things out I found a solution for me:

According to:

I had to install new version of filepicker

Further I had to downgrade underscore and lodash to fit my typescript version:

npm i -D @types/lodash@ts2.4
npm install @types/underscore@ts2.3

Duplicate Errors came from the SQLite plugin in combination with the SQLcipher adapter:

ionic cordova plugin add cordova-sqlite-storage@2.4.0
ionic cordova plugins add cordova-sqlcipher-adapter

Last but not least build it with
ionic cordova build ios -- --buildFlag="-UseModernBuildSystem=0"
LegayBuildSystem in Workspace Preferences in Xcode

replace following code inside platfrom/ios/cordova/lib/list-emulator-build-targets

current code-------
if (device.name === deviceType.name.replace(/-inch/g, ’ inch’) &&
device.availability.toLowerCase().indexOf(‘unavailable’) < 0) {
availAcc.push(device);
}
new code-----------
if(device.name === deviceType.name || device.name === deviceType.name.replace(/-inch/g, ’ inch’))
{
if (device.isAvailable ||(device.availability && device.availability.toLowerCase().indexOf(‘unavailable’)<0)) {
availAcc.push(device);
}
}

3 Likes

@sagar1412 Thank you so much! It worked.

Thanks, @sagar1412 , it works.