Heads up... You're reading this book for free, with parts of this chapter shown beyond this point astext.
In this chapter, you’ll learn how to use Xcode and TestFlight to distribute your Flutter app’s iOS version.
Unlike with Android, apps can’t be sideloaded onto iOS devices. To distribute your app to users and testers, you have to go through App Store Connect, Apple’s developer portal for the App Store. TestFlight allows you to send apps to testers and gather feedback from both your internal team and the outside world.
For this chapter, you’ll need to use a Mac with Xcode installed. You’ll also need a valid Apple Developer Program account to access the App Store.
If you’re following along with your app, open it and keep using it with this chapter. If not, locate the projects folder for this chapter and open the starter folder.
Note: If you use the starter app, don’t forget to add your apiKey and apiId in network/recipe_service.dart. Also, run
flutter pub getfrom the IDE’s terminal.
Run your app on an iOS simulator to set up the necessary files in the iOS folder.
Creating the signing
It’s time to leave Android Studio (or VS Code) and move over to Xcode. Open the workspace file ios/Runner.xcworkspace. This workspace includes the main app projects and the CocoaPods dependencies you need to build the app.
In the Project navigator, check if there’s a folder arrow next to Pods. If not, close the Xcode project, return to Android Studio and run your app on an iOS simulator. This will pull all the required files. When you’re done, re-open ios/Runner.xcworkspace.
Select Runner in the Project navigator to open the project editor. Select the Runner target and open the General tab.
For app submission, it’s important to check the Bundle Identifier. This has to be unique for your app. If you want to follow along with this tutorial to test out the process — that is, not submit — you still have to change the existing value. Try using a random unique string if you are out of ideas.
Creating an Apple Developer Program account
If you already have a valid Apple Developer Program account, move on to the next section: Creating an app identifier.
Creating an app identifier
In the developer portal, you’ll tell Apple about your app.
Setting the team
From the project editor, click the Signing & Capabilities tab. This will allow you to select a team. Select your developer team in the drop-down. If you aren’t signed in through Xcode, choose Add an Account… to sign in.
Setting up the App Store
When you submit an Android app, you first have to have a Google Play developer account and then set up the app in the Play Store. For iOS (and macOS) apps, you need to follow the same procedure for Apple.
Creating a new app
Before you can upload and distribute a build, you first have to create a record for the app by adding some basic information.
Uploading to the App Store
On Android, you made an appbundle to distribute to the Play Store. iOS has a parallel concept. You’ll need to build an archive to upload to the App Store. You can do this from either Xcode or the command line. For this chapter, you’ll use Xcode.
Uploading the build
From the organizer window, click Distribute App.
Sharing builds through TestFlight
Now, you’re ready to test your build. There are two options for test builds: Internal Testing and External Testing.
You can begin internal testing as soon as the app finishes processing. To add testers from the TestFlight tab of the App store console, just select App Store Connect Users under the Internal Testing header.
Internal testing is limited to a few people who are in your store account. Obviously, you don’t want to give store access to testers who aren’t part of your organization.
- You have to configure the Apple Developer Portal and App Store Connect before you can upload a build.
- Use Xcode to archive the project to easily upload your app to the App Store.
- Use TestFlight for internal and external testing of iOS apps.
Where to go from here?
If you want to take this to the next level and learn more about app signing or distributing and selling to customers in the App Store, then iOS App Distribution & Best Practices https://www.raywenderlich.com/books/ios-app-distribution-best-practices is for you.