microsoft / vsts-cordova-tasks

Streamline CI setup for your Apache Cordova, PhoneGap, Ionic, or Cordova CLI compatible app using a set of useful pre-defined build steps for VS Team Services or TFS
http://go.microsoft.com/fwlink/?LinkID=691188
Other
25 stars 27 forks source link

ionic cordova build ios - Issue with xcode - Cannot read property 'toLowerCase' of undefined #90

Open rcampbell22 opened 6 years ago

rcampbell22 commented 6 years ago

I have a step in my release pipeline using the Ionic Command task for "cordova build ios --release"

This was working successfully on the 16th October using the hosted macOS agent, however it is now failing with the error: "Cannot read property 'toLowerCase' of undefined"

The verbose logging exposes the error better:

Cannot read property 'toLowerCase' of undefined
TypeError: Cannot read property 'toLowerCase' of undefined
at /Users/vsts/agent/2.141.1/work/ionic/platforms/ios/cordova/lib/list-emulator-build-targets:54:44
at Array.forEach (native) at /Users/vsts/agent/2.141.1/work/ionic/platforms/ios/cordova/lib/list-emulator-build-targets:52:44
at Array.reduce (native) at /Users/vsts/agent/2.141.1/work/ionic/platforms/ios/cordova/lib/list-emulator-build-targets:50:57
at Array.reduce (native) at /Users/vsts/agent/2.141.1/work/ionic/platforms/ios/cordova/lib/list-emulator-build-targets:45:28
at _fulfilled (/Users/vsts/agent/2.141.1/work/ionic/platforms/ios/cordova/node_modules/q/q.js:854:54)
at self.promiseDispatch.done (/Users/vsts/agent/2.141.1/work/ionic/platforms/ios/cordova/node_modules/q/q.js:883:30)
at Promise.promise.promiseDispatch (/Users/vsts/agent/2.141.1/work/ionic/platforms/ios/cordova/node_modules/q/q.js:816:13)

From what I can find online (https://github.com/apache/cordova-ios/issues/427), this issue seems to be with cordova-ios and compatibility with xcode 10. From my previously successful logs on 16 October, I can see it was using Xcode 9.4.1 but I'm assuming the host is now using Xcode 10 (maybe 10.1 beta 3?)

I have tried telling the host to use Xcode 9.4.1 by using the sudo xcode-select -s /Applications/Xcode_9.4.1.app/Contents/Developer (as suggested here: https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=vsts&tabs=yaml#xcode), and confirmed this is set with xcode-select -p and it shows the correct path, but the Ionic command still fails, so I'm wondering if it is definitely using 9.4.1 and it's still failing (in which case the error is something else), or if I have to tell the Ionic command to use a specific version of Xcode a different way?

UPDATE: The above is a red-herring as I've just proved that it is using the version from the xcode-select command. So the issue is actually that I'm getting the error with the same cordova, ionic and xcode version that I wasn't getting a few weeks back. The only thought now is that the hosted MacOS agent has been updated and that's what is causing the issue

naz01101011 commented 5 years ago

Issue is still present, cordova build iOS fails with similar error. Using Cordova 9.0.0 and cordova-ios 5.0.0 on Azure DevOps. The build goes fine if using an older Cordova version, like 7.1.0, but Apple does not accept IPAs built on SDK 11.x...