XCode: New Mac, new developer cert, duplicate keeps reapearing - xcode

So: I got a new Mac. I went to the developer provisioning portal, then revoked my certificate. I created a new one.
Now whenever I open XCode it complains that I have duplicate developer certificates. And yes, when I check with Keychain, there are two. I then delete the oldest one, but XCode is apparently very much in love with the old one: It keeps recreating it.
What to do?

Answer here:
Xcode could not find a valid private certificate/valid key-pair for this profile in your keychain
Short version: Delete all certificates from your keychain. Delete all provisioning from XCode via the Organizer. Request and generate new certificates in the iOS provisioning portal. Download the new provisions and import them into XCode by doubleclicking. FInally, go to your project and make sure that the right signing is selected, just to make sure.

Related

Provisioning profile doesn't include signing certificate (Xcode 9.3)

After upgrading to macOS 10.13.4 and Xcode 9.3, my project now makes all my Provisioning Profile ineligible! They worked before upgrade.
The error message for the distribution profile is:
Provisioning profile "distribution profile name" doesn't include signing certificate "development certificate name"
So I search through the forum,
remove ALL items in keychain My Certificate
redownload the distribution profile
(double tap to install to Xcode)
create new distribution profile (double tap to install to Xcode)
recreate the Production certificate (double tap to install to Keychain)
redownload the Development certificate (double tap to install to Keychain)
So now my keychain has two production certificate (one is newly created), and one development certificate, and the error is still there. I found it weird that it asked for the development certificate in distribution profile? (I think this is a clue but I don't know why and what to do.)
So now what should I do? Please help!
I got two options for you:
1) open KeyChain and find the signing certificate that shown in the error message then delete it.
2) you specified the signing certificate in the Build Setting->Signing, so go to the Build Setting->Signing and click the Code Signing Identity. Do not select Automatic (iOS Developer or iOS Distribution), select the one of the signing certificates in the Identities in Keychain which is valid and have associated with the Provisioning Profile.
For XCode 11 and later make sure to update the profile certificate updated with "For use in Xcode 11 or later" which resolves the issue for me.
I temporary solved the issue by going into Build Settings, and manually set Code Signing Identity (the old way). "Automatically manage signing" no longer work properly, but at least it work.
"Automatically manage signing" is not working on Xcode 9.3. Code signing identify should be selected manually in Build Settings.
It is right.
You can select Code Signing Identity as iOS developer for development and iOS distribution for production in Signing of build settings.
check out screenshot it says it all...
Targets>>Build settings>>(search)Product bundle identifier>>this was wrong for me :(
You need to make sure that:
Your Apple Development -> Certificates, Identities & Profiles all have the correct provisioning profile "distribution profile name" that include signing certificate as in fig 1. below
Same inside xCode
fig 1.
"Automatically manage signing" is not working on Xcode 9.3.
Code signing identify should be selected manually in Build Settings.
I had to juggle a bit more too. I deleted my keychain, enabled and disabled autosigning before recreating my certificates.
Then I toggled the certificates in Build Settings section and finally I was able to select the correct certificates in general section.
Really missing the simplicity of signing for Android.. :P
In my case, the Provisioning Profile on developer.apple.com listed two developer certificates. One was selected, and one was not. Changed it so both were selected, saved that, installed the updated profile and that fixed it.
In my case, I changed the Provisioning Profile to solve the problem by changing the Certificate whose type is "iOS Distribution" to another Certificate whose type is "(Distribution) For use in Xcode 11 or later", then download it and import it to keyChain, select it form Xcode.
For anyone running in this issue in 2022 an later..
Sometimes it doesn't include Profiles, so go to below screen and click Edit.
Select the profiles you want to include.
After that, you can go back to xcode and download the profile again.
For me, adding the certificate to the Keychain which is linked to the provisioning profile did not help, which was very strange.
What I did to solve the issue is close XCode and re-open it, which seems stupid but worked! Apparently, it seems XCode does not dynamically read newly added certificates in the Keychain, so you have to close it (if it is kept open while adding the certificate to Keychain) and open it again.
My XCode version: 14.1
In my case I had multiple profiles and various certs. I had to go to Apple developer and edit the profile from the error, and add every cert to it, and then it worked.
in my case, previous certificate got expired , while creating the new provisional certificate i missed to select ios distribution (in house).
If you have this certificate on another machine, you can export it from keychain and import on the other.
My problem was that I didn't know how to match private keys with certificates because I used "all items" filter in KeyChain.
If you switch to Certificates private keys are arranged under certificates, so you can easily export the right pair.

XCode is unable to create a distribution signing identity

I am trying to submit my app to iTunes Connect. I have submitted it before(TestFlight) but at some point my certificates have stopped working. I have tried to renew them with 2 different approaches without any success.
Approach 1: In XCode I get the error that says that the developer profile already has a distribution certificate and suggest me resetting it. Resetting results in the same pop up window so this goes into a loop and does not work.
Approach 2: If I create the certificates and profiles manually in developer portal the archiving process only works if I select the correct identities in the build settings, otherwise the build fails and XCode says that it can not find code signing identities. But I cannot submit the archive because the following error occurs:
I have also tried exporting the .ipa from the archive(to upload it with Application loader) but this does not find the signing identities as well with the same error:
So now I am trying to go the suggested route where XCode is supposed to do all the work for me.(https://developer.apple.com/library/ios/qa/qa1814/_index.html) For a clean slate I have deleted all certificates, key-pairs and provisioning profiles from my mac and developer center.
I have removed all relevant keypairs and certificates from keychain. I have deleted all the provisioning profiles from my mac. I have also deleted all certificates and profiles from the developer site. I have also deleted and re-added the developer account in XCode settings.
I set the project's build settings:
I also set the team in general tab.
Now I guess XCode is supposed to fix my signing issues but after I press fix issues below the team option in general tab
I still go to the reset development/distribution certificate loop.
One thing I notice is that XCode does generate a key-pair to the keychain but not the certificate.
How can I upload my app to iTunes Connect with or without these problems?
Im using XCode 7.2 and this is a Unity3D app.
I have removed all relevant keypairs and certificates from keychain
Okay, but that is what Xcode is complaining about (each time it says "but it is not installed locally" in all the messages you have displayed). You need the private/public certificate pairs in your keychain. If you deleted the private half of the certificates, that is a huge mistake, because you can never restore it (Apple does not have it — it is private). You now will probably have to start all over again by throwing away absolutely everything — all certificates, all provisioning — both locally and at the member center, and beginning from scratch.
This can be done, but it is not trivial, because if you launch Xcode while any remnant remains, Xcode will try to install the certificate back into your keychain. To do it, you would need to delete everything from the keychain, mobile provisions folder, and member center, with Xcode not running.
I managed to upload the package by extracting the .ipa from the archive with
xcodebuild -exportArchive -exportFormat ipa -archivePath {path-to-xcarchive} -exportProvisioningProfile {“profile name”} -exportPath ~/Desktop/MyApp.ipa
and then uploading it with Application Loader.

Provisioning Profile 'Valid signing identity not found' error

I have an app that is ready for testing on my iPad, and I've created a development provisioning profile, matched up the bundleID and lowered the iOS deployment target.
However when I downloaded the profile and dragged it into the organizer, it says 'Valid signing identity not found'. I'm pretty sure this has got to do with the certificates in the keychain and private keys (???) however I have no idea how to fix this problem.
Can someone please point me to a tutorial or give me some advice on adding certificates into the keychain without using Xcode; stuff like the 'use for development' button isn't working for me!
Note:
The only valid Provisioning Profiles are distribution.
When I try to click 'Renew' Xcode says 'No value was provided for the parameter 'CertificateIDs'. I hope this helps!
The .p12 file associated with your provisioning profile is not found in your system keychain.
Check the below few things!
Make sure you have enabled the correct certificate while generating the provisioning profile in the apple developer site.
Check if you have any duplicates of the your certificate & private key more than once in your keychain access.
If you do not have the .p12 corresponding to the provisioning profile, Get it exported from the mac system on which it was created & install it in your mac system.
Check your code signing identity set your profile there.
and your Provisioning profile bundle id is same as your app bundle identifier.
To do a valid code-signing - without using XCode - you need a valid certificate and key, corresponding to the provisioning profile :
check with Keychain Access that you indeed have a 'iPhone distribution' certificate, with its own private key.
Make sure this is the same certificate that was used on 'provisioning portal' to create you developement / distribution profile. If not, create a new one, or import the certificate from the other Mac you used when you created the provisioning
Download the provisioning profile, and just double-click it.
Posting this here because none of the other answers really went into enough detail to help me and I still had to figure it out on my own.
On the apple developer website, log in and under certificates click 'All'. The certificate needs to be generated on YOUR machine and with YOUR account or things do not build. This is what confused me... You can click the + icon and make a new certificate (development, or distribution). If it does not let you select for example Distribution, it's because there are already too many certificates in the account. So first, you have to delete an older certificate.
1) Delete the oldest certificate in the portal
2) Click the + and create a new certificate -- this will guide you through opening Keychain Access on your machine and requesting a certificate from apple, and you will have to save a file and upload it to the developer portal to create the certificate.
3) Download the new certificate and it will add to Keychain access
4) Go back to provisioning profiles on dev portal, click EDIT on the one you are trying to use and change it to use the newly generated certificate.
5) Download and click the provisioning profile
6) Everything works great.
This process actually was not that difficult, but for some reason I could not find the correct explanation anywhere. I hope this will help someone.
I had the same issue. I did have all the private keys and everything was correct, but xcode refused to build and kept saying that I didn't have a valid provisioning profile and organiser showed 'valid signing identity not found'.
The solution involved:
revoking my developer certificate and development provisioning profiles from the ios provisioning portal
deleting those certificates from keychain
try building again and tell xcode to 'fix issue'
This lets XCode manage the certificates, and it magically worked.
However on another project I still had the problem, and it was solved by this answer:
https://stackoverflow.com/a/18966088/1192732

MAS: Code Signing Identity Private Key

I've removed all development and installer certificates from the development portal, created a new CSR and generated new Application and Installer certificates.
Now I'm about to distribute the App to the MAS and am constantly presented with this error:
"Name" is a valid identity. However, the private key for the associated package
identity "Name" is not installed on this Mac.
Developer Profiles from a different Mac can be imported.
This puzzles me, since the private key is on the System, how else could I've generated the certificates without them?
Double check you have removed all old certs, there is a menu item in the KeyChain app to show all expired certs. I threw away all expired certs and things started working.
Got it working:
Created a new user account on my Mac
Cloned the repo there
Removed all Provisioning Profiles and Certificates from the Dev Portal
Let Xcode generate all the Certificates for you
Upload works!
The problem is Mac Installer Distribution certificate.
The easiest way to have everything fixed and loose all the troubles just go to Xcode->Window->Organizer->Devices and then on the lower right corner press on Refresh and log in with your account... xcode will generate and download all the certificates and provisioning profiles needed.
I followed the instructions and deleted all expired certificates from the keychain and refreshed the profiles list within the organizer. How ever the error only vanished after I restarted Xcode.

no valid keychain for xcode

after 6 month of break I try to finish my first app.
After I downloaded the new XCode and the new SDK (I needed it, because old XCode and SDK was 4.3, my iPhone was on 5.0.1) I try to build, but it told me my signiture was to old.
So I cleared all things I have found in my keychain: certificates, keys and so on.
I remember that it is a really really mess, but I tried the last 5 hours withour writing a single line of code...
At the moment I created a new certificate in the Apple Online Portal.
I downloaded and double click it, so it's in the Organizer now.
The error from XCode when try to start on my device is now:
There are no valid certificate/private key pairs in the default keychain
Can someone help me? (Skype would be nice), I am really lost in this after 5 ours of triend all I found on google and get very very lost.
When you are installing certificates first time you will have to install "Apple Worldwide Developer Relations Certification Authority".
Check whether it is available in the system tab of keychain access.
If you double click the certificate and provide password, it may be possible that it gets added to system tab. So make sure it is added to the login tab.You can just drag and drop the certificate from system to login.
In xcode organiser window you should see the provisioning profiles. If you don't see your profile there install the profile double clicking it. Also check profiles' expiry date.!
Hope this Helps!

Resources