iOS code signing

iOS builds are signed with a distribution certificate and a provisioning profile. With an App Store Connect API key, AppRelease takes care of both.

Requirements

  • An Apple Developer Program membership.
  • The app's bundle identifier registered under Certificates, Identifiers & Profiles → Identifiers.
  • An App Store Connect API key with App Manager access (steps below).

Creating the App Store Connect API key

  1. Log in to App Store Connect and go to Users and Access → Integrations → App Store Connect API.
  2. Click + next to Active keys.
  3. Name the key (for example "AppRelease") and choose the App Manager role.
  4. Click Generate, then Download API Key. The .p8 file can only be downloaded once.
  5. Note the Issuer ID above the table and the Key ID in the row.

Adding the key to AppRelease

  1. In the console open Credentials → Add credential → App Store Connect API key.
  2. Pick the .p8 file, enter the Key ID and the Issuer ID.
  3. Click Save. The key is encrypted and never shown again; the runner uses it for signing, for the build number and for the upload.
Only the Account Holder or an Admin of the Apple developer account sees the App Store Connect API page; other roles have to ask them for the key.

Automatic signing

Before the scripts run, the runner asks App Store Connect for a distribution certificate (creating one if there is none that AppRelease holds the private key for) and for a provisioning profile matching the bundle identifier and distribution type. Both are installed into a temporary keychain that is deleted when the build ends.

workflows:
  ios-workflow:
    environment:
      ios_signing:
        distribution_type: app_store   # app_store | ad_hoc | development
        bundle_identifier: com.example.app

Apps with more than one target (an extension, a watch app) list every identifier:

      ios_signing:
        distribution_type: app_store
        bundle_identifier:
          - com.example.app
          - com.example.app.widget

Manual signing

Not needed and not supported: with the API key in place, Xcode resolves the certificate and the provisioning profile itself, for App Store, ad hoc and development builds alike. There is nothing to upload besides the key.

Export options

Either way the runner writes an export options plist and exposes it as AR_EXPORT_OPTIONS. Pass it to the build:

flutter build ipa --release --export-options-plist="v">$AR_EXPORT_OPTIONS

The runner also sets AR_CERTIFICATE_NAME, AR_PROVISIONING_PROFILE and AR_TEAM_ID, should a custom Xcode step need them.

Troubleshooting

MessageUsually means
No profiles for 'com.example.app' were foundThe bundle identifier in ios_signing does not match the one in Xcode, or is not registered in the developer portal.
Provisioning profile doesn't include signing certificateManual signing with a profile made for a different certificate. Regenerate the profile, or switch to automatic signing.
Authentication credentials are missing or invalidThe API key was revoked, or Issuer ID and Key ID were swapped.