Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using VSTS to build and deploy ionic app to both android and IOS

I have a ionic v1 app that I am trying to create both an android and ios version of the app using a Visual Studio Team Services build definition. The app builds out for both ios and android. I am now howerver having trouble with the Xcode IOS build of the app.

ionic cordova build ios --release

The above command creates the ios platform along with the xcode project and workspace file.

I then have the following VSTS XCode tasks to try build the ipa file for the ios app. enter image description here

I have created both the p12 cert and provisioning profile and added them to the project. Both of which pass when running the build definition.

Here is my Xcode build configuration

enter image description here

The build definition fails at this point with the following erros

Code Signing Error: App has conflicting provisioning settings. App is automatically signed for development, but a conflicting code signing identity iPhone Distribution has been manually specified. Set the code signing identity value to "iPhone Developer" in the build settings editor, or switch to manual signing in the project editor.

and

Code Signing Error: Code signing is required for product type 'Application' in SDK 'iOS 11.1'
like image 207
psycho Avatar asked Nov 21 '17 14:11

psycho


2 Answers

After trying both manual and automatic signing with no joy, I finally got it to work with a few minor tweaks.

  1. When installing the apple certificate, select temporary keychain and supply a password. If you don't use this the build agent will be waiting for user input to type the keychain password causing the build to timeout.
  2. Switch to manual signing.
  3. In the apple certificate install task and the Xcode build task to set the "Certificate Signing Identity" equal to the full name of the cert including the team name in brackets.
like image 58
psycho Avatar answered Oct 19 '22 04:10

psycho


In my case, I was able to build, archive and export the ionic iOS App integrating a build.json file in the project structure, at root level:

{
   "ios": {

      "release": {
          "codeSignIdentitiy": "iPhone Distribution: TEAM_NAME (TEAM_ID)",
          "developmentTeam":"TEAM_ID",
          "provisioningProfile": "UUID",
          "packageType": "ad-hoc" 
      }
  }
}

Notice that in my case I wanted to generate and ad-hoc distribution, but you can generate the app for the store, development or enterprise distribution.

Once the project is prepared and built, an exportOptions.plist file is generated in the iOS Cordova project with all the configuration to export the app and generate the IPA file.

Take a look at the cordova documentation about using build.json here: https://cordova.apache.org/docs/en/latest/guide/platforms/ios/

Then, In the Xcode VSTS task, I followed all the recommendations from @psyco : Manual signing using the full name for the signing identity and the provisioning profile UUID.

Also take into account that for the provisioning profile name, Xcode 9 (the one used by default on VSTS Mac OS Agents at this moment) does not accept Xcode-generated Provisioning Profile (with "XC iOS" in the name), mine was like that and was weird to find the solution, thanks to Cœur Xcode 9: Provisioning profile is Xcode managed, but signing settings require a manually managed profile

With all those things, finally I was able to do it, and also to send the IPA to App Center using another VSTS task, so the IC cycle was completed.

like image 23
rtrujillor Avatar answered Oct 19 '22 05:10

rtrujillor