Build and release an iOS app

Contents
  • Preliminaries
  • Register your app on App Store Connect
    • Register a Packet ID
    • Create an application record on App Store Connect
  • Review Xcode project settings
  • Updating the app'southward deployment version
  • Updating the app's version number
  • Add together an app icon
  • Create a build archive with Xcode
  • Create a build archive with Codemagic CLI tools
  • Release your app on TestFlight
  • Release your app to the App Store
  • Troubleshooting

This guide provides a pace-by-footstep walkthrough of releasing a Flutter app to the App Store and TestFlight.

Preliminaries

Xcode is required to build and release your app. You must use a device running macOS to follow this guide.

Before beginning the process of releasing your app, ensure that it meets Apple tree's App Review Guidelines.

In lodge to publish your app to the App Store, you lot must kickoff enroll in the Apple Developer Program. You can read more than virtually the various membership options in Apple'southward Choosing a Membership guide.

Annals your app on App Store Connect

Manage your app's life cycle on App Store Connect (formerly iTunes Connect). You define your app name and clarification, add screenshots, gear up pricing, and manage releases to the App Store and TestFlight.

Registering your app involves two steps: registering a unique Bundle ID, and creating an awarding record on App Store Connect.

For a detailed overview of App Store Connect, see the App Store Connect guide.

Register a Bundle ID

Every iOS application is associated with a Parcel ID, a unique identifier registered with Apple. To register a Bundle ID for your app, follow these steps:

  1. Open the App IDs page of your developer account.
  2. Click + to create a new Bundle ID.
  3. Enter an app name, select Explicit App ID, and enter an ID.
  4. Select the services your app uses, so click Continue.
  5. On the next page, confirm the details and click Register to register your Parcel ID.

Create an awarding record on App Store Connect

Register your app on App Shop Connect:

  1. Open App Store Connect in your browser.
  2. On the App Store Connect landing page, click My Apps.
  3. Click + in the summit-left corner of the My Apps page, and then select New App.
  4. Make full in your app details in the class that appears. In the Platforms section, ensure that iOS is checked. Since Palpitate does non currently back up tvOS, go out that checkbox unchecked. Click Create.
  5. Navigate to the application details for your app and select App Data from the sidebar.
  6. In the Full general Data section, select the Bundle ID y'all registered in the preceding footstep.

For a detailed overview, see Add an app to your account.

Review Xcode project settings

This step covers reviewing the most important settings in the Xcode workspace. For detailed procedures and descriptions, meet Prepare for app distribution.

Navigate to your target'southward settings in Xcode:

  1. In Xcode, open Runner.xcworkspace in your app's ios folder.
  2. To view your app's settings, select the Runner projection in the Xcode project navigator. Then, in the main view sidebar, select the Runner target.
  3. Select the General tab.

Verify the most important settings.

In the Identity section:

Display Name
The display name of your app.
Parcel Identifier
The App ID you registered on App Shop Connect.

In the Signing & Capabilities section:

Automatically manage signing
Whether Xcode should automatically manage app signing and provisioning. This is set true by default, which should be sufficient for most apps. For more complex scenarios, see the Code Signing Guide.
Team
Select the team associated with your registered Apple Developer account. If required, select Add Account…, then update this setting.

In the Build Settings section:

iOS Deployment Target
The minimum iOS version that your app supports. Flutter supports iOS 9.0 and later. If your app or plugins include Objective-C or Swift code that makes use of APIs newer than iOS 9, update this setting to the highest required version.

The General tab of your projection settings should resemble the following:

Xcode Project Settings

For a detailed overview of app signing, come across Create, export, and delete signing certificates.

Updating the app's deployment version

If you lot changed Deployment Target in your Xcode projection, open ios/Palpitate/AppframeworkInfo.plist in your Flutter app and update the MinimumOSVersion value to match.

Updating the app'southward version number

The default version number of the app is i.0.0. To update it, navigate to the pubspec.yaml file and update the following line:

version: 1.0.0+ane

The version number is three numbers separated past dots, such as ane.0.0 in the example above, followed by an optional build number such as i in the instance above, separated by a +.

Both the version and the build number may be overridden in Palpitate's build by specifying --build-name and --build-number, respectively.

In iOS, build-name uses CFBundleShortVersionString while build-number uses CFBundleVersion. Read more near iOS versioning at Core Foundation Keys on the Apple Developer's site.

Add an app icon

When a new Palpitate app is created, a placeholder icon fix is created. This step covers replacing these placeholder icons with your app's icons:

  1. Review the iOS App Icon guidelines.
  2. In the Xcode projection navigator, select Assets.xcassets in the Runner folder. Update the placeholder icons with your ain app icons.
  3. Verify the icon has been replaced by running your app using flutter run.

Create a build annal with Xcode

This stride covers creating a build archive and uploading your build to App Shop Connect.

During evolution, you've been building, debugging, and testing with debug builds. When you're ready to send your app to users on the App Store or TestFlight, you need to prepare a release build. At this signal, y'all might consider obfuscating your Dart code to go far more than difficult to contrary engineer. Obfuscating your lawmaking involves adding a couple flags to your build control.

In Xcode, configure the app version and build:

  1. In Xcode, open Runner.xcworkspace in your app's ios folder.
  2. Select Runner in the Xcode project navigator, then select the Runner target in the settings view sidebar.
  3. In the Identity department, update the Version to the user-facing version number y'all wish to publish.
  4. In the Identity section, update the Build identifier to a unique build number used to track this build on App Store Connect. Each upload requires a unique build number.

Finally, create a build archive and upload it to App Store Connect:

  1. Run palpitate build ipa to produce a build archive.

  2. Open build/ios/archive/MyApp.xcarchive in Xcode.

  3. Click the Validate App push. If any issues are reported, address them and produce another build. You lot can reuse the same build ID until yous upload an archive.

  4. After the archive has been successfully validated, click Distribute App. You can follow the status of your build in the Activities tab of your app'southward details page on App Store Connect.

You should receive an email within 30 minutes notifying you that your build has been validated and is bachelor to release to testers on TestFlight. At this bespeak you can choose whether to release on TestFlight, or go ahead and release your app to the App Store.

For more details, see Upload an app to App Shop Connect.

This pace covers creating a build archive and uploading your build to App Store Connect using Flutter build commands and Codemagic CLI Tools executed in a concluding in the Palpitate project directory. This allows y'all to create a build archive with full command of distribution certificates in a temporary keychain isolated from your login keychain.

  1. Install the Codemagic CLI tools:

                    pip3                  install                  codemagic-cli-tools                              
  2. You'll need to generate an App Store Connect API Primal with App Manager access to automate operations with App Store Connect. To make subsequent commands more concise, set the post-obit environment variables from the new cardinal: issuer id, key id, and API key file.

                                      export                                    APP_STORE_CONNECT_ISSUER_ID                  =aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee                  export                                    APP_STORE_CONNECT_KEY_IDENTIFIER                  =ABC1234567                  export                                    APP_STORE_CONNECT_PRIVATE_KEY                  =                  `                  cat                  /path/to/api/fundamental/AuthKey_XXXYYYZZZ.p8`                              
  3. You need to export or create an iOS Distribution document to lawmaking sign and packet a build archive.

    If yous take existing certificates, you tin export the private keys by executing the following command for each document:

                    openssl pkcs12                  -in                  <certificate_name>.p12                  -nodes                  -nocerts                  | openssl rsa                  -out                  cert_key                              

    Or you tin create a new private key by executing the following control:

                    ssh-keygen                  -t                  rsa                  -b                  2048                  -one thousand                  PEM                  -f                  cert_key                  -q                  -N                  ""                              

    Later, y'all tin have CLI tools automatically create a new iOS Distribution from the private key.

  4. Set upwards a new temporary keychain to be used for code signing:

  5. Fetch the code signing files from App Shop Connect:

                    app-shop-connect fetch-signing-files                  $(xcode-projection detect-package-id)                  \                  --platform                  IOS                  \                  --type                  IOS_APP_STORE                  \                  --certificate-key                  =@file:/path/to/cert_key                  \                  --create                              

    Where cert_key is either your exported iOS Distribution certificate private key or a new private key which automatically generates a new document. The document will be created from the private key if information technology doesn't exist in App Store Connect.

  6. At present add the fetched certificates to your keychain:

                    keychain add-certificates                              
  7. Update the Xcode project settings to use fetched code signing profiles:

                    xcode-project use-profiles                              
  8. Install Flutter dependencies:

  9. Install CocoaPods dependencies:

                    find                  .                  -name                  "Podfile"                  -execdir                  pod                  install                  \;                              
  10. Build the Flutter the iOS project:

                    flutter build ipa                  --release                  \                  --export-options-plist                  =                  $Abode/export_options.plist                              

    Note that export_options.plist is the output of the xcode-project employ-profiles command.

  11. Publish the app to App Store Connect:

                    app-shop-connect publish                  \                  --path                  $(find                  $(                  pwd                  )                  -name                  "*.ipa"                  )                              
  12. As mentioned earlier, don't forget to set your login keychain as the default to avoid authentication issues with apps on your machine:

Yous should receive an email within 30 minutes notifying you lot that your build has been validated and is available to release to testers on TestFlight. At this indicate you lot tin cull whether to release on TestFlight, or go alee and release your app to the App Store.

Release your app on TestFlight

TestFlight allows developers to push their apps to internal and external testers. This optional step covers releasing your build on TestFlight.

  1. Navigate to the TestFlight tab of your app'southward application details page on App Store Connect.
  2. Select Internal Testing in the sidebar.
  3. Select the build to publish to testers, then click Save.
  4. Add the e-mail addresses of whatever internal testers. You tin can add additional internal users in the Users and Roles page of App Store Connect, available from the dropdown menu at the pinnacle of the page.

For more details, see Distribute an app using TestFlight.

Release your app to the App Shop

When y'all're fix to release your app to the earth, follow these steps to submit your app for review and release to the App Store:

  1. Select Pricing and Availability from the sidebar of your app's awarding details page on App Store Connect and complete the required information.
  2. Select the status from the sidebar. If this is the first release of this app, its status is i.0 Prepare for Submission. Complete all required fields.
  3. Click Submit for Review.

Apple notifies you when their app review procedure is consummate. Your app is released according to the instructions yous specified in the Version Release department.

For more details, run into Distribute an app through the App Store.

Troubleshooting

The Distribute your app guide provides a detailed overview of the process of releasing an app to the App Shop.