Check out this practical guide on how to do it!
Prerequisites
1. OpenSSL
2. Expo CLI and Expo account
3. Repository with application built in Expo
4. Apple Developer account (with app manager role)
Generate a Certificate Signing Request
1. In order to acquire an iOS Distribution Certificate (which will be needed later on in creating Provisioning Profile and building the app) first we have to generate a Certificate Signing Request (CSR).
2. Open OpenSSL (openssl.exe inside “OpenSSL-Win64/bin” folder). If you are using Windows, you probably don’t have it. Download and install it first (when prompted, install OpenSSL binaries inside /bin directory).
3. Create a private key:
genrsa -out private.key 2048
4. Create a CSR:
req -new -key private.key -out CertificateSigningRequest.certSigningRequest -subj "/emailAddress=< email>/CN=< common name >/C=< country code >"
-email - your email address. Should match with the Apple Developer account email -common name - your name, ie. John Doe (accepts UTF-8 characters). Should match with the Apple Developer account name -country code - your country code, ie. US
Generate an iOS Distribution Certificate
1. Once you have the CSR, now you can generate a iOS Distribution Certificate. Log into the iOS Developer Portal and go to the “Certificates, Identifiers & Profiles” and “Certificates” section. Add a new certificate by pressing the “plus” button.
2. Choose “iOS Distribution (App Store and Ad Hoc)”on the page “Create a New Certificate” and press “Continue”.
3. Lastly, choose your CSR file and press “Continue”.
4. If this is successful you should be given the option to download the resulting iOS Distribution Certificate. Download the certificate and save it in the OpenSSL bin folder.
Create an app ID
1. If you don’t have it yet, you will have to add an app ID. In order to do that, go to the “Certificates, Identifiers & Profiles” and “Identifiers” section. Click the “plus” button.
2. Choose “App IDs”in “Register a New Identifier”.
3. On the “Register an App ID” set your “Description” and the “Bundle ID” explicitly (should match with your app.json file).
4. Also check “Push Notification” if your application uses them.
5. Once done, press “Continue”.
Register a device
1. You may also need to add your device on which you want to test the app. Go to the “Certificates, Identifiers & Profiles” and “Devices” section. Click the “plus” button.
2. Fill in the form with your device information in “Register a New Device” and press “Continue”..
Create a Provisioning Profile
1. Go to the “Certificates, Identifiers & Profiles” and “Profiles” section. Click the “plus” button.
2. Choose “App Store”in “Register a New Provisioning Profile”and press “Continue”.
3. Choose your App ID In “Generate a Provisioning Profile” and press “Continue”.
4. On the next page choose your iOS Distribution Certificate and press “Continue”.
5. Once created, download your provisioning file (extension .mobileprovision).
Generate a Push Notifications key
1. Go to the “Certificates, Identifiers & Profiles” and “Keys” section. Click the “plus” button.
2. In “Register a New Key” enter your “Key Name” and check “Apple Push Notifications service (APNs)”. Press “Continue”.
3. Once registered, download your key file (extension .p8).
Create Personal Information Exchange File
The last file you will need is the file with the extension .p12 (called Personal Information Exchange File). 1. CreatePrivacy Enhanced Mail by typing in OpenSSL:
x509 -in ios_distribution.cer -inform DER -out pem_file.pem -outform PEM
ios_distribution.cer - this should match with iOS Distribution Certificate
pem_file.pem - you can adjust it to your needs
2. Create .p12:
pkcs12 -export -inkey private.key -in pem_file.pem -out app_p12.p12
app_p12.p12 - you can adjust it to your needs
3. You will be asked for a password. Create one and remember it. You will need it whenever you are using a .p12 file.
Build iOS App Store Package
1. The last step to obtain the iOS standalone app is to build the iOS App Store Package (IPA) with Expo CLI. Open your favourite console and navigate to the project. Then enter:
expo build:ios
2. If you have any problems with certificates later on, use:
expo build:ios -c
3. Once asked about build type, choose “archive”.
4. Login with your Apple Developer account.
5. You will be asked for Apple Distribution Certificate. Choose “I want to upload my own file”. Then put the path to your “.p12” file and enter the password.
6. Next you will be asked for Apple Push Notifications service key. Choose “I want to upload my own file”. Then put the path to your “.p8” file and enter the “Key ID” (by default it should be in the file name).
7. Lastly, you will be asked for Apple Provisioning Profile. Choose “I want to upload my own file”. Then put the path to your “.mobileprovision” file.
8. Now you have to wait for the build queue. You can monitor the build on your account’s Expo dashboard. Once it’s built, you will be able to download an IPA file.
Troubleshooting
If you have any problems with OpenSSL or Expo CLI commands on Windows, try to install and use WSL.
コメント