You get an email with the subject “iOS Distribution Certificate Expires in 30 Days” and the body message reads as:
Your iOS Distribution Certificate will no longer be valid in 30 days.
This means you need to generate a new certificate to sign your iOS or any apple device (macOS, watchOS, etc.) app.
Below is the step-by-step guide to generating new certificates and set them on your Xcode.
First of all Create a Certificate Signing Request (CSR)
- Launch Keychain Access located in /Applications/Utilities.
- Go to Keychain Access > Certificate Assistant > Request a Certificate from a Certificate Authority.
- Fill the form as below:
- User email address: youremail@example.com
- Common name: your name cert
- CA email address: {leave blank}
- Request is: Saved to disk
- Note: If you are using VPN, then turn it off. Otherwise, in some case, the cert will not be generated and saved on disk.
Generate New Certificate
- Login to the apple developer account (developer.apple.com)
- Go to Certificates, Identifiers & Profiles page
- Click the + icon to create a new certificate
- Choose the software type. If you are using Xcode 11 or later, then it’s good to choose “Apple Development” to sign development version. For signing distribution of apps, you can choose “Apple Distribution”. They support all iOS, macOS, tvOS, and watchOS apps.
- Click on “Continue” button
- Choose the cert file you created above (Certificate Signing Request (CSR))
- Click on “Continue” button
- Now the certificate is created
- Download the certificate
Save the certificate to keychain
- Double click on the downloaded certificate
- It will open a window, and when you click the button present there, then the certificate is saved in your keychain.
Check the certificate on keychain
- Open keychain
- On the left hand site, under “Keychains”, click on “login”. And, under “Category”, click on “My Certificates”. This will show you the recently added certificates. You can also sort the certificates by “Expires” date column.
Add the certificates in Xcode
- Go to Xcode > Preferences
- Go to Accounts tab
- Click on your apple id
- Click on the Team name
- Click on the “Manage Certificates” button
- Click on the + icon
- Select “Apple Development” and the apple development certificate will be auto imported.
- Select “Apple Distribution” and the apple distribution certificate will be auto imported.
If you have set automatic signing on Xcode, then Xcode will automatically choose/update the signing key to the one with the recently created with the longest expiry date.
Hope this helps. Thanks.