Can I choose a Code signing team without pushing the .xcworkspace-file

Hi

I’m trying to incorporate iOS code signing in my workflow but I get this error telling me to select a devevlopment team. I can’t find anywhere to do this besides in my xcode project locally on my computor. Does this mean that I need to push my entire ios-folder containing the .xcworkspace-file or is there a better solution?

Hi, if the error is printed by xcode-archive step the source of the issue is that you uploaded multiple code singing files and with these files there more then one selection which can be used to sign your project (at the ipa export phase). To solve this the step notifies you to define more export options in the step.

The development team related export options is: "The Developer Portal team to use for this export" under Export Options category. I would also recommand to specify non auto-detect value for the Select method for export input.

Hi, thanks for answering.

I tried doing that, selecting my development team under Export Options but I keep getting the same error. I can’t see the error right under the build, there it only says “Archive failed, error: exit status 65”. But if I check the raw_xcodebuild_output.log-file it says that I haven’t selected any development team.

Maybe I didn’t select my team correctly, I tried entering the team name and I tried entering the code that’s next to the name in the logs but I got the same error both times.

Hi @kungnattis,

Can you please copy paste the related build’s bitrise.io URL? We’d need the full log for more thorough debugging :slight_smile:

Just a hunch, but if you get the “no team selected” error from Xcode itself, then it might be an Xcode issue, that Xcode in some cases “forgets” to save the selected team ID into the project file. Usually the fix is to open the project in Xcode, change the Team ID to something else, then change it back; that should make Xcode to write the team ID into the project file.

You can change the Team ID on the General tab of the project in Xcode, in the Signing section:

Here is the URL: https://www.bitrise.io/build/43ac6f2160ec6522

But I’m guessing that your hunch is right, I just don’t know how to fix it. Do I need to add the Xcode project file to my repository? Or should I select a team in Xcode before I export the certificates?

1 Like

Ahh, it’s an ionic app!

I see you still use the “old” approach, to do the archive with an actual Xcode Archive step. That most likely won’t work with newer Xcodes unfortunately, as Ionic’s generated Xcode project is usually not compatible with Xcode out of the box.

Instead, the recommended way (and if you register an Ionic app right now this is how the auto generated config looks like) is to use the Ionic archive step, which uses ionic CLI commands to do the archive instead of using Xcode directly.

Just registered an Ionic project and this is how the current auto generated config looks like for it:

---
format_version: '4'
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
project_type: ionic
trigger_map:
- push_branch: "*"
  workflow: primary
- pull_request_source_branch: "*"
  workflow: primary
workflows:
  primary:
    steps:
    - activate-ssh-key@3.1.1:
        run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
    - git-clone@3.5.2: {}
    - script@1.1.4:
        title: Do anything with Script step
    - certificate-and-profile-installer@1.8.8: {}
    - npm@0.9.0:
        inputs:
        - command: install
    - generate-cordova-build-configuration@0.9.3: {}
    - ionic-archive@1.0.0:
        inputs:
        - platform: "$IONIC_PLATFORM"
        - target: emulator
    - deploy-to-bitrise-io@1.3.7: {}
app:
  envs:
  - opts:
      is_expand: false
    IONIC_PLATFORM: ios,android

(I registered this official ionic sample repo for the test: https://github.com/ionic-team/ionic-conference-app ).

Can you please try to replace the Xcode Archive step with the Ionic Archive @kungnattis?

I’m sorry, I should have mentioned that it is an ionic app.

I tried doing as you said and I don’t get any errors anymore, thank you! But I was hoping to get a signed ipa-file that I can upload to iTunes Connect. That’s why I was using the xcode archive step because the documentation that I found about iOS signing told med to. But maybe I missed something?

1 Like

For Ionic the best is to use the Ionic Archive step, instead of the Xcode Archive one, simply because the default generated Xcode project can’t be archived with the latest Xcode versions, but Ionic Archive (and the ionic tools when generating the iOS archive) sets some required parameters for the archive.

Ok, thank you!

But if I want my iOS app signed so I can upload it to app store, do I need another step for that? I already have the step that gathers the certificates but I guess I need something that uses them to sign the app? Just like the Sign APK-step does for the android app.

1 Like

The step you’re looking for is the generate-cordova-build-configuration one, which should be right before the ionic-archive step (as you can see in my auto generated config above Can I choose a Code signing team without pushing the .xcworkspace-file - #6 by viktorbenei ).

With that step you can provide the configuration options for the Ionic/Cordova tools for the build/archive.

Thank you for all your help! But I still don’t get that .ipa-file. I’ve changed the packing type in the “Generate cordova build”-step and I’ve tried filling in all the other input variables in that step.
What am I missing?

Hi @kungnattis,

Can you please copy paste the build’s bitrise.io URL? Without logs it’s hard to tell what the issue is :slight_smile:

Here’s the URL: https://www.bitrise.io/build/1ac733a4eef6cbae :slight_smile:

Checked the build and everything was “green”, so I guess the issue you’re referring to is that you get a .app for the iOS app and not a .ipa.

If you want to generate a .ipa (which can be installed on iOS devices) then please change the Target from emulator in the ionic-archive step:

+------------------------------------------------------------------------------+
| (2) ionic-archive@1.2.1                                                      |
+------------------------------------------------------------------------------+
| id: ionic-archive                                                            |
| version: 1.2.1                                                               |
| collection: https://github.com/bitrise-io/bitrise-steplib.git                |
| toolkit: go                                                                  |
| time: 2017-12-06T02:21:50-08:00                                              |
+------------------------------------------------------------------------------+
|                                                                              |
e[36mINFOe[0m[02:21:50]  * e[32;1m[OK]e[0m Step dependency (go) installed, available. 
e[34;1m(gradle) isn't installed, installing...e[0m
e[34;1m * e[32;1m[OK]e[0m gradle installede[0m
e[36mINFOe[0m[02:22:09]  * e[32;1m[OK]e[0m Step dependency (gradle) installed, available. 

e[34;1mConfigs:e[0m
- Platform: ios,android
- Configuration: release
- Target: emulator
- BuildConfig: /var/folders/90/5stft2v13fb_m_gv3c8x9nwc0000gn/T/__bitrise-cordova-build-config__023864481/build.json
- Options: 
- Username: 
- Password: 
- IonicVersion: 2.1.4
- CordovaVersion: 7.0.1
- CordovaIosVersion: 
- CordovaAndroidVersion: 
- WorkDir: /Users/vagrant/git
- DeployDir: /Users/vagrant/deploy

...

Simply change the Target from emulator to device. Actually the default value of the step for this input is device so at some point you did change this to emulator.

Anyway, just change the target and if the code signing infos are correct it should work :slight_smile:

Hi again :slight_smile:

I didn’t get an .app file either, I only got a .zip file with what I guess is the iOS version of the app in it. But yes, I want an .ipa file instead.

I tried changing Target to device in the ionic-archive step but I still don’t get the .ipa file. And now I don’t get the .zip file either, all I get now is the android files.

Here’s the URL for the build: https://www.bitrise.io/build/91fbde116dfe25c8

Correct, that’s the .app - technically a .app is just a directory, nothing special about it, it’s only MacOS which treats it specially. E.g. if you copy a .app to a Linux or Windows machine then it’ll be just a regular folder there. That’s why the step ZIPs the .app, to make it a “single file” which can be uploaded/deployed.

Thanks, we’ll check it ASAP! :slight_smile:

@kungnattis can you try to run the ionic build command yourself on your own Mac?

From the log:

ionic "build" "--release" "--device" "ios" "--buildConfig" "/path/to/build.json"

You can find the content of the build.json in the log of the generate-cordova-build-configuration step.

Does this generate a ipa on your own Mac?

Also: how do you generate an ipa on your Mac usually? What’s the command you use?

I get this error when trying to build it on my Mac with the content from the generate-cordova-build-configuration-step:
Check dependencies
Code Signing Error: Provisioning profile “iOS Team Store Provisioning Profile: com.ngenic.tune” is Xcode managed, but signing settings require a manually managed profile.
Code Signing Error: Code signing is required for product type ‘Application’ in SDK ‘iOS 11.2’

I poked around a bit and found that it works if build.json looks like the example under “Xcode 8 and iOS 10” here: https://cordova.apache.org/docs/en/latest/guide/platforms/ios/#signing-an-app

The content generated from the generate-cordova-build-configuration-step looks like the “Earlier versions”-example on the same page, maybe that’s the reason?

1 Like

Thanks @kungnattis for the info! I reported this for the Tooling team, they’ll check it ASAP and update the step(s) if required! :slight_smile:

Great! Thank you for all your help :slight_smile:

1 Like