Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOs build fails - UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'toLowerCase' of undefined #675

Closed
tgomezc opened this issue Sep 25, 2019 · 9 comments

Comments

@tgomezc
Copy link

tgomezc commented Sep 25, 2019

Bug Report

Problem

Since the last xCode update to version 11.0, I can't make any build for iOs, it throws this error in the process.
Any enlightenment on this would be helpful.

What does actually happen?

(node:3043) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'toLowerCase' of undefined at /Users/username/Documents/petpo-fe-mobile-bugs/platforms/ios/cordova/lib/list-emulator-build-targets:54:45 at Array.forEach (<anonymous>) at /Users/username/Documents/petpo-fe-mobile-bugs/platforms/ios/cordova/lib/list-emulator-build-targets:52:44 at Array.reduce (<anonymous>) at /Users/username/Documents/petpo-fe-mobile-bugs/platforms/ios/cordova/lib/list-emulator-build-targets:50:57 at Array.reduce (<anonymous>) at /Users/username/Documents/petpo-fe-mobile-bugs/platforms/ios/cordova/lib/list-emulator-build-targets:45:28 at _fulfilled (/Users/username/Documents/petpo-fe-mobile-bugs/platforms/ios/cordova/node_modules/q/q.js:854:54) at /Users/username/Documents/petpo-fe-mobile-bugs/platforms/ios/cordova/node_modules/q/q.js:883:30 at Promise.promise.promiseDispatch (/Users/username/Documents/petpo-fe-mobile-bugs/platforms/ios/cordova/node_modules/q/q.js:816:13) (node:3043) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:3043) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

@renatoflorencia
Copy link

I am experiencing the same problem after updating xcode.
My current project has the following versions:

cordova : 8.0.0
ios platform: ^ 4.5.5
xcode: 11.0
IOS version: Mojave 10.14

(node:18636) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'toLowerCase' of undefined

@brody4hire brody4hire added support info-needed Further information is requested labels Sep 25, 2019
@brody4hire
Copy link

A minimal reproduction project would really help us better understand what may be going on.

@tgomezc
Copy link
Author

tgomezc commented Sep 26, 2019

Well, finally solve this out. This may help other people as the xcode update is really new and there isn't much info about this.
I was using iOS platform v4.5.4. Apparently xcode 11 has some conflict with a validation in the file list-emulator-build-targets.
What you have to do is this:
-remove ios platform from Cordova
-excute command: ionic cordova platform add ios@latest

This will install ios v5.0.1 which works out fine with xcode 11.

@namello-zmtp
Copy link

list-emulator-build-targets:

Line 50: Change the following statement to below:

            var availableDevices = Object.keys(devices).reduce(function (availAcc, deviceCategory) {
                var availableDevicesInCategory = devices[deviceCategory];
                availableDevicesInCategory.forEach(function (device) {
                    if (device.name === deviceType.name.replace(/\-inch/g, ' inch') && 
                        !("availabilityError" in device)) {
                            availAcc.push(device);
                        }
                });
                return availAcc;
            }, []);

They changed the simulator device properties, now, availability is an optional prop, which is only present when there is an error. This will fix it :)

@brody4hire
Copy link

brody4hire commented Sep 26, 2019

Can you guys please help us with a few things:

  • This looks like it may be an issue with Cordova and Ionic. A plain reproduction project would really help us understand this issue more quickly.
  • Can someone explain more clearly why the existing bin/templates/scripts/cordova/lib/list-emulator-build-targets script does not work for you guys?
  • Formal PR with clear directions of how we can validate it would be really awesome.

Maintainers are completely overloaded since a couple major companies pulled out of Apache Cordova.

@almercier
Copy link

almercier commented Sep 27, 2019

@brodybits I don't have the time to make a plain reproduction project, but I can confirm that the fix @namello-zmtp suggested did indeed fix the error for me.

This was already resolved for v5 with #451 and is a duplicate of #427 . It came back again because people (like me for example) that are still using cordova-ios v4 had to upgrade xCode from before v10.1 to the newest v11 released a week ago to get iOS 13 sims. We are tied to cordova-ios v4 for now, so updating to v5 is not an option for us. Is it possible to get this patch in v4 as v4.5.6?

@dpogue
Copy link
Member

dpogue commented Sep 27, 2019

We are tied to cordova-ios v4 for now, so updating to v5 is not an option for us. Is it possible to get this patch in v4 as v4.5.6?

cordova-ios v4.x is no longer supported or maintained.

@dpogue dpogue closed this as completed Sep 27, 2019
@JPAlfa
Copy link

JPAlfa commented Oct 7, 2019

I got this error after XCode updated to 11.0, but I couldn't go to cordova-ios 5 yet. So I made a downgrade on XCode and somehow I still get this error. I'm with Xcode 10.2.1 and cordova-ios 4.5.4. I already used the xcode-select to choose the right command-line-tools, but didn't work. What am I missing?

@brody4hire brody4hire added invalid and removed help wanted info-needed Further information is requested labels Oct 7, 2019
@apache apache locked as resolved and limited conversation to collaborators Oct 7, 2019
@brody4hire
Copy link

I am locking this issue since we consider it to be resolved, and we do not have any extra bandwidth to monitor and support any further discussions.

I would like to express our appreciation to those who gave tips and other input.

In general, we do not support old major releases due to both the quick obsolescence and our lack of extra support resources.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants