Search code examples
objective-cxcodeprovisioning-profileprivate-key

Provisioning profile "XXXXXX" doesn't include signing certificate "iPhone Distribution: XXXXXXXXXX (XXXXXXXXXX)".


I have been asked to update an old project done in objective-c.

I'm having this issue with my distribution provisioning profile. It goes like this

Provisioning profile "XXXXXX" doesn't include signing certificate "iPhone Distribution: XXXXXXXXXX (XXXXXXXXXX)".

The thing is I can see the certificate "iPhone Distribution: XXXXXXXXXX (XXXXXXXXXX)" in my keychain. But there are 2 of them. One has a private key and the other one doesn't and both have a different expiry date. When I checked the developer account, the distribution provisioning profile is signed with certificate that doesn't have a private key (the expiry date of the certificate shown on developer account is that of the one without private key)

  1. What is causing this issue?
  2. How can I fix it?
  3. What if I can't get the private key from the older machine(as that machine is no more usable)

I tried deleting one of the certificates, and also automatically manage signing. Both didn't work.

Please help.


Solution

    1. The problem is that the only valid provisioning profile you have tied to the distribution certificate for which you do not have the private key. Without the private key, it is not a valid signing identity, so Xcode won't use it.

    2. To fix this, You will need to create a new private key / distribution certificate, and then create a new distribution profile using the newly created certificate. You can find instructions, starting with creating the cert signing request, here.

    3. See 2 above. Without the key, you can't use the existing certificate. If you are needing to build from multiple Macs, you need to set up a sharing mechanism to provide the private key to any other Macs that will be downloading and using the certs / profiles from the Apple's site. I would also back up the private key so that you won't run into this in the future if something happens to your build Mac. Also, when the cert expires, it is helpful to keep the .csr file from answer 2 above. This means you can use the same private key for the new cert when your distribution cert expires.