In this article, I will be showing how to distribute Native iOS project containing Flutter modules using Codemagic CI/CD.
The two main steps for distribution are:
- Code signing
- Publishing to App Store Connect
This is a follow-up article to “How to add Flutter modules to native iOS project and test it on Codemagic”.
Code signing
In order to publish your app to Apple App Store, you need to have a code-signed .ipa
file. Before starting with the actual code signing process, you will need to have the following things:
- Certificate Signing Request (CSR)
- iOS Distribution Certificate
- App ID
- Provisioning Profile
Generating the Certificate Signing Request (CSR)
You will need a Mac to generate the CSR. The generated CSR will be stored on the local machine and contains some information related to the developer identity, which is later used by Apple for confirming the identity while generating the certificate.
- Open Keychain Access using Spotlight Search on Mac.
- From the top menu bar go to Keychain Access > Certificate Assistant > Request a Certificate From a Certificate Authority.
![](https://blog.codemagic.io/uploads/2020/03/CSR_1.png)
- Fill out the Certificate Information form. Leave the CA Email Address field empty. Select the option Saved to disk. Then, click on Continue.
![](https://blog.codemagic.io/uploads/2020/03/CSR_2.png)
- Now, you can click on Show in Finder to go to the folder where the CSR file has been created.
![](https://blog.codemagic.io/uploads/2020/03/CSR_3.png)
- Click on Done.
iOS Distribution Certificate
You will need an Apple Developer Membership in order to generate a certificate from the Apple Developer Portal. Various types of certificates can be generated from the portal, but to publish our app to Apple App Store we will be needing an iOS Distribution Certificate.
Follow the steps below to generate the distribution certificate:
- Go to the Apple Developer Portal and sign in using your Apple ID and password.
- Select the Certificates, IDs & Profiles option from the left menu on the Dashboard.
![](https://blog.codemagic.io/uploads/2020/03/certificate_1.png)
- Under the Certificates option, click on the “+” button.
![](https://blog.codemagic.io/uploads/2020/03/certificate_2.png)
- Select the iOS Distribution option and click on Continue.
![](https://blog.codemagic.io/uploads/2020/03/certificate_3.png)
- Click on Choose File to upload the CSR file that we had generated previously. Click Continue.
![](https://blog.codemagic.io/uploads/2020/03/certificate_4.png)
- Now, you can Download the generated iOS Distribution Certificate to your local machine.
![](https://blog.codemagic.io/uploads/2020/03/certificate_5.png)
- Double-click on the downloaded certificate to add it to your local device’s Keychain.
- You can export any certificate from your Keychain by right-clicking and selecting Export.
- You will have to supply a Certificate Password for securing the certificate.
#ios