Xcode archive fails with errors: "There are no accounts registered with Xcode" and "Code signing is required for product type 'Application'"

fastlane
ios-auto-provision
ios
#1

I try to build Flutter iOS app and my workflow is as follows:

  • Flutter release build with --no-codesign option :heavy_check_mark:
  • Fastlane step:
    • register_devices :heavy_check_mark:
    • fastlane match for ad-hoc :heavy_check_mark:
    • build_app
    • appcenter_upload

Fastlane’s build_app fails with following error even though match step indicates that all provisioning profiles are installed.

fastlane match finishes with success:

[21:21:31]: All required keys, certificates and provisioning profiles are installed :raised_hands:

build_app executes and breaks with error:

[21:21:45]: ▸ Code Signing Error: There are no accounts registered with Xcode. Add your developer account to Xcode
[21:21:45]: ▸ Code Signing Error: No profiles for ‘pl.app.app.test’ were found: Xcode couldn’t find any iOS App Development provisioning profiles matching ‘pl.app.app.test’.
[21:21:45]: ▸ Code Signing Error: Code signing is required for product type ‘Application’ in SDK ‘iOS 12.2’

Also, when building locally with exactly the same commands on my machine (i.e. flutter build and fastlane copied from Bitrise log) everything works fine.

I’ve already connected my Apple Developer account to the Bitrise account but it didn’t help.

I tried to run Certificate and profile installer but with no success.

I also tried to archive the iOS app with Xcode Archive & Export for iOS step (xcode-archive@2.5.0), but it also fails with the error:

Code Signing Error: Code signing is required for product type ‘Application’ in SDK ‘iOS 12.2’

Example failing build is this one https://app.bitrise.io/build/35c02d47a95ee181

I tried a lot of things and frankly I don’t know what else I can try. Maybe different Apple Developer account? I can provide any further details if url to build is not sufficient.

0 Likes

#2

Hi @dominik.roszkowski!

Sorry to hear about the issue! Have you tried including a development type profile as well? You seem to be missing that in this build and that could likely cause this error

0 Likes

#3

I’ll try that! Is development profile enough if I want to use ad-hoc?

0 Likes

#4

No you need both, you’re gonna need a development type profile for every export method, that’s the issue I think :slightly_smiling_face:

0 Likes

#5

Ok, I exported my p12 file (according to this guide) and mobile provisioning files from Apple developer portal, and then imported them into Bitrise workflow.

Unfortunately, this didn’t solve the issue. Example build with error: https://app.bitrise.io/build/a1476e111cfee9a6

One of the errors is as follows, but I connected my Apple account with Bitrise:

Ensure cookies for Apple Developer Portal
Failed to activate the Bitrise Apple Developer Portal connection: %!s(MISSING)
Read more: https://devcenter.bitrise.io/getting-started/signing-up/connecting-apple-dev-account/
errors
Falied to fetch portal data from Bitrise, error: Response status: 404 - Body: {“error_msg”:“No Apple developer account found for this build.”}

0 Likes

#6

Have you also selected your developer portal account on the Team tab of the app? :thinking:

0 Likes

#7

I selected my account in Team tab now but the error persists.

I don’t understand why fastlane match is able to download and install all the required profiles, but later when archiving with Xcode it doesn’t work. Maybe multiple schemes defined in my Xcode project are problematic?

I’ll try to switch to manual provisioning in Xcode and push changes to repository.

0 Likes

#8

Oh I see, this message about your Developer Portal was printed out by the fastlane step as a bug, sorry about that!

But otherwise your fastlane match command seemed to have failed, also if I’m correct uploading your p12 on Bitrise wouldn’t have an effect on this build since you’re still using the match to import them from another repo

0 Likes

#9

After setting all the provisioning profiles manually in Xcode the build succeeded.

So what I had to do was:

  • disable automatic provisioning in my Xcode target
  • set fastlane generated profile for desired configuration

This way I don’t use provided by Bitrise mechanisms of provisioning and can abstract it to the fastlane step.

My current workflow in fastlane is like follows:

platform :ios do
  desc "Submit a new build to AppCenter"
  lane :test do
    register_devices(
        devices_file: "../../devices.txt",
        team_id: "XXXX",
        username: "XXXX@XXXX.pl"
    )
    match(
      type: "adhoc",
      force_for_new_devices: true,
    )
    automatic_code_signing(
      use_automatic_signing: false # on my dev-machine I use automatic provisioning
    )
    update_project_provisioning(
      profile: ENV["sigh_pl.XXXX.XXXX.test_adhoc_profile-path"], # fastlane match stores path to the mobileprovisining file in this variable
      build_configuration: "Release-tst", # I had to specify exact configuration name
      code_signing_identity: "iPhone Distribution" 
    )
    build_app(
      scheme: "tst",
      configuration: "Release-tst",
      xcargs: "-allowProvisioningUpdates",
      export_options: {
        signingStyle: "manual",
        method: "ad-hoc",
        provisioningProfiles: {
          "pl.XXXX.XXXX.test": "match AdHoc pl.XXXX.XXXX.test"
        }
      },
      output_name: "Runner.ipa"
    )
    appcenter_upload(
      app_name: "XXXX-XXXX-1",
      owner_name: "XXXX",
      group: "All-users-of-XXXX-XXXX",
      ipa: "Runner.ipa"
    )
  end

And bitrise.yml for this step is:

  test:
    before_run:
    - prepare
    steps:
    - flutter-build@0.9.2:
        inputs:
        - android_additional_params: "--release -t lib/$TARGET_FILE.dart --flavor
            $FLAVOR --build-name=$FL_VERSION_NUMBER --build-number=$FL_BUILD_NUMBER"
        - project_location: "$BITRISE_FLUTTER_PROJECT_LOCATION"
        - ios_additional_params: "--release --no-codesign -t lib/$TARGET_FILE.dart
            --flavor $FLAVOR --build-name=$FL_VERSION_NUMBER --build-number=$FL_BUILD_NUMBER"
        is_always_run: true
    - set-env-var@0.9.1:
        inputs:
        - destination_keys: APPCENTER_DISTRIBUTE_APK
        - value: "$BITRISE_APK_PATH"
        title: APPCENTER_DISTRIBUTE_APK
    - fastlane@2.4.0:
        title: fastlane iOS
        inputs:
        - work_dir: "$BITRISE_FLUTTER_PROJECT_LOCATION/ios"
        - lane: ios test
    - fastlane@2.4.0:
        inputs:
        - work_dir: "$BITRISE_FLUTTER_PROJECT_LOCATION/android"
        - lane: android test
        title: fastlane Android
    after_run:
    - finish
    envs:
    - opts:
        is_expand: false
      FLAVOR: tst
    - opts:
        is_expand: false
      TARGET_FILE: main_tst

Thank you @bitce for all your help and guidance! I appreciate it a lot.

1 Like

closed #10

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.

0 Likes