When developer certificate is close to expire or you have provisioning conflicts you may need to have a fresh start. Start with creating a new certificate:
- Revoke the old certificate from IOS portal/Certificates
- Create a new certificate from Keychain Access on Mac using KeyChainAccess/Certificate Assistant/Request a Certificate From a Certificate Authority menu option and Save to Disk.
- From IOS portal/Certificates upload new certificate then Submit. Refresh browser.
- Download IOS Development Certificate (ios_development.cer) and run.
Remove the duplicate development certificate
This step is required to fix an error when you build your project in XCode, after installing new certificate:
CodeSign error: Certificate identity 'iPhone Developer: XXXX (12345678)' appears more than once in the keychain. The codesign tool requires there only be one.
Somehow the old developer certificate is cached in XCode and added to KeyChain. To fix this it needs to be removed from KeyChain. The old developer certificate has an earlier expiration date and it is labelled as "iPhone developer..".
- Exit XCode
- In KeyChain Access under Login KeyChain/My Certificates category remove the old developer certificate starting with "iPhone developer..".
- In KeyChain Access under System KeyChain/Certificates category remove the old developer certificate starting with "iPhone developer..".
- Start XCode. This may recreate the old certificate again. Repeat steps 2 and 3.
App IDs
On the Provisioning Portal App IDs section enable required entitlements (such as iCloud) for both wildcard XXXXXXXXXX.* and XXXXXXXXXX.com.company.product.* App IDs. Enable all entitlements for simplicity.
Create Provisoning Profiles
On IOS Provisioning Portal delete all provisioning profiles under Provisioning section.
You need to create:
Create Provisoning Profiles
On IOS Provisioning Portal delete all provisioning profiles under Provisioning section.
You need to create:
- A Development Provisioning Profile for wildcard App ID
- An AppStore Distribution Profile for product App ID
- An Adhoc Distribution Profile for product App ID
On XCode:
- Remove all provisioning profiles under Organizer/Library and Organizer/Device sections.
- Under Library/provisioning Profiles click Refresh on the bottom right.
- Check that under Organizer/Device required profiles were created. If not drag them from Organizer/Library section.
Setup XCode
On XCode
- Create two Schemes "Adhoc" and "App Store" from Product/Edit(New) Scheme.
- Set Archive/Build configuration of Adhoc scheme to "Adhoc distribution"
- Set Archive/Build Configuration of App Store scheme to "Release".
- On Build Settings/Targets pick Ad Hoc Distribution Profile for Ad Hoc Distribution Code Signing Identity.
- On Build Settings/Targets pick Team Provisioning Profile (generated by XCode) for Debug Code Signing Identity.
- On Build Settings/Targets pick App Store Distribution Profile for Release Code Signing Identity.
- Delete Product
.entitlements file. - On Targets/Summary check Entitlements box and fill relevant entitlements. For example if your app uses iCloud, check Enable iCloud checkbox and add your product App ID to Ubiquity Containers section.
- Some sections will be filled and created by XCode.
If you complete all above successfully you should be able to Debug your app on a connected device, upload your app in Ad Hoc distribution mode to your device, upload your app to App Store, or run your app on a simulator.
When you are ready to submit to App Store make sure to pick up the App Store Scheme, then Archive.
References:
Video on certificate creation:
CodeSign error: Certificate identity 'iPhone Developer: XXXX (12345678)' appears more than once in the keychain
References:
Video on certificate creation:
CodeSign error: Certificate identity 'iPhone Developer: XXXX (12345678)' appears more than once in the keychain