How to renew an iPhone development certificate?

2019-01-10 05:20发布

My development certificate has expired. What is the correct method of renewing it? Do you revoke the expired certificate & submit a new Certificate Signing Request? Do provisioning profiles have to be recreated? Are there any side-effects of doing this?

9条回答
相关推荐>>
2楼-- · 2019-01-10 06:20

See also this post if the provisioning profiles silently fail to renew after recreating the certificates using Baryon Lees answer for Xcode 5

renewing provisioning profile and certificates

You have to go edit each profile and check the certificate box and generate but don't download.

查看更多
迷人小祖宗
3楼-- · 2019-01-10 06:21

When my distribution profiles were within two days of expiring, I tried to extend them. I found that what was really expiring were the identity certificates in my keychain, to which all the profiles were tied. And I couldn't find any way of renewing the identity certificates; I had to delete my certificates from the keychain and create them from scratch, as described here:

https://developer.apple.com/library/ios/#qa/qa1618/_index.html

...Delete the certificate from your Keychain, then follow the "Obtaining your iPhone Development Certificate" or "Obtaining your iPhone Distribution Certificate" section in the iPhone Developer Program Portal User Guide to generate a new certificate

However, my problems didn't end there. Now I had a new certificate, and I was able to create a distribution profile as described here:

https://developer.apple.com/library/ios/#recipes/ProvisioningPortal_Recipes/CreatingaDistributionProvisioningProfile/CreatingaDistributionProvisioningProfile.html

However, I still couldn't create a distribution build (ad hoc or for the App Store), because Xcode complained that there were two distribution certificates in my keychain, and (it said) there Must Be Only One. But how could that be? I had deleted the expiring certificates. Yet sure enough, it was true: the expiring certificates that I had deleted had returned to my keychain!

In the end I figured out that it was Xcode itself that was somehow recreating the expiring certificates — presumably based on information inside the expiring development and distribution profiles that Xcode still contained. That's right, Xcode was creating a second certificate in my keychain, and then complaining that there were too many certificates in my keychain!!!!

So I deleted all the development and distribution profiles from Xcode, and then deleted the expiring certificates from my keychain again.

But that still didn't solve the problem, because Xcode proceeded to download all the profiles from the Portal again! And when it did so, it created the expiring certificates in my keychain again!!

So in the end I had to delete everything:

  1. I deleted all distribution and provisioning profiles from the Portal, so that Xcode couldn't download them again.

  2. I deleted all the distribution and provisioning profiles from Xcode.

  3. I also deleted all the distribution and provisioning profiles from my devices, just to be on the safe side.

  4. I deleted the expiring identity certificates from my Keychain, one last time.

At last I was left with a clean slate. So now I re-downloaded the distribution profile that I'd created at the Portal, and I was able to create a distribution build of my app and upload it to iTunes Connect.

My final problem was that now I couldn't build and run (develop) on my devices, because I'd deleted the expiring "team development profile". I couldn't find any way to make a new one at the Portal, and I couldn't find any way to ask for one in Xcode, but in the end I hit upon a lucky chance: I hooked one of my devices to the computer and asked Xcode to add it at the Portal, even though it had already been added to the Portal previously. This worked - it caused Xcode to ask the Portal for a new team development profile, and at last I was fully back in business. I was able to develop on my devices with the team development profile, and I was able to create distribution profiles and download them and build with them for Ad Hoc or App Store builds.

So what I learned from this adventure is: When your certificates expire, delete everything (all certificates and profiles) and start over from scratch.

查看更多
你好瞎i
4楼-- · 2019-01-10 06:25

Xcode 4.6 handles all of it for you - this process is now much easier than in the accepted answer.

See this link for details.

I believe the key to this process working is waiting until your certificate expires.

Here's how I did it in less than 60 seconds with Xcode 4.6:

1. Wait for your Developer certificate to expire
2. Open Xcode, open Organizer (cmd-shift-2)
3. Click on "Devices" at the top, then "Provisioning Profiles" under Library on the left
4. Click the Refresh button in the bottom right corner.
5. Xcode will detect you have no valid cert and ask if you'd like to submit a request for one - say yes.
查看更多
登录 后发表回答