Provisioning Profile 'Valid signing identity not found' error - xcode

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

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.

"Warning: unable to build chain to self-signed root for signer" warning in Xcode 9.2

I'm attempting to migrate an Xcode project to another computer. It gives me the warning "Warning: unable to build chain to self-signed root for signer" and when it runs it crashes immediately similarly to what is shown in this Stack Overflow:
App working on simulator but not on iPhone( dyld`__abort_with_payload dyld`_dyld_start)
My issue seems similar to what is described on the Apple Developer Forums here:
https://forums.developer.apple.com/thread/86161
and similar to what is described on this Stack Overflow:
Xcode ios app development code signing
except the suggestions of deleting certificates and re-adding them, re-adding my account and restarting didn't seem to help. I have removed my developer cert for the second time and now I don't see it coming back, and I'm at a loss of knowing how to get it back since my dev portal doesn't appear to have a place to download it like it used to.
I've also tried deleting the derived data folder several times.
e: I've determined ANY project on this computer results in the same crash and warning.
If none of the other solutions work, try adding the intermediate signing certificates to your system keychain. I found this while trying to manually create provisioning profile/certificates as nothing else was working - from the Create a New Certificate step of the New Provisioning Profile process on Apple Developer platform:
To use your certificates, you must have the intermediate signing certificate in your system keychain. This is automatically installed by Xcode. However, if you need to reinstall the intermediate signing certificate click the link below:
Worldwide Developer Relations Certificate Authority (Expiring 02/07/2023)
Worldwide Developer Relations Certificate Authority (Expiring 02/20/2030)
After downloading these two files and double-clicking them to automatically add to the system keychain, the automatic provisioning profile in xcode started working (I didn't need to complete the manual provisioning profile process, but that's where I found the links)
I had the same problem and fixed with below steps:
Open Keychain Access
Select login, and click Certificates
Double click Apple Worldwide Developer Relations Certificate Authority
Expand the trust section, then next to "When using this certificate", change the setting from "Always Trust" to "Use System Defaults"
Clean the build folder and run
In my case the error was only resolved after I deleted Apple Worldwide Developer Relations Certification Authority which expires in 2023 from both System and login keychains and imported the other certificate that is valid until 2030. It seems that codesign was picking the incorrect one when both were present in the keychain.
I could fix the issue by downloading a new certificate from here and installing it.
Look at https://developer.apple.com/de/support/expiration/ for more detail.
I have been facing same issue for days now. Finally i solved it by just changing my root CA from Key Chain Access.
View in System/ Login key chains. which certificate authority is being used as signer for your personal provisioning profile's certificate. Enter a valid CA certificate and you are good to go!
Hope it helps.
Ciao!
#waaheeda's answer led me in the right direction to fix this.
I have a keychain in my repo which is used for signing on my CI. After renewing my iOS enterprise distribution certificate and provisioning profile and updating the keychain accordingly, my CI signing stopped working. Code signing worked locally on my own machine.
I suddenly stumbled upon this and found this part particular interesting:
Enterprise iOS Distribution Certificates generated after September 2, 2020 require the new intermediate certificate installed on any machines that will be code signing.
I therefore found the "Apple Worldwide Developer Relations Intermediate Certificate Expiration" in my local "login" keychain in Keychain Access and added it to the keychain in my repo, and it seems to have fixed the signing for now (and hopefully until 2030):
This is too late to answer , but if anybody still looking for solution on this thread --
this happens if you are installing certificate for the first time or installing certificate which is created on another machine
In your Xcode project go to signing capabilities enter correct bundle identifier, disable automatic signing , select appropriate profile / import / download profile
then you will find trust repair option below profile , tap on it tap on trust enter your login credentials
this will create and install following certificates
1.change the certificate trust: "Always Trust" ==> "Use System Defaults"
2.change "codesign" command ==> "sudo codesign" command
3.change the "Apple Worldwide Developer Relations Certificate Authority" certificate in login and system items trust: "Always Trust" ==> "Use System Defaults"
worked for me when use codesign command in command line
In the machine where you created the certificate
Open keychain
Look for "Apple Worldwide Developer Relations Certificate Authority"
Look at the column "Expires" and check apple.com/CertificateAuthority to see which has the same expiration
G1 Expiring 02/07/2023
G2 Expiring 05/06/2029
G3 Expiring 02/20/2030
In your ci
Install this certificate to your system keychain
a. via fastlane
import_certificate(
certificate_path: "~/Downloads/AppleWWDRCAG3.cer"
)
b. via cli
sudo security import ~/Downloads/AppleWWDRCAG3.cer \
-k /Library/Keychains/System.keychain \
-T /usr/bin/codesign \
-T /usr/bin/security \
-T /usr/bin/productbuild
In my case I had an automatically signed project and my own developer certificate was not trusted (anymore) which was apparent in Keychain > login > certificates. On my own certificate I put Always trust in the Get Info popup.
After that I had to select again the "Automatically manage signing" in the Signing & Capabilities tab, which gave an error like "Repair trust settings". After clicking that it fixed the trust of my developer CA.
Also when it was again broken after this, I copied the G3 Apple Worldwide Developer Relations CA from the login keychain (default keychain) to the System Keychain (System).
1.open xcode-> Preferences-> Accounts
2.select you appleid and click on Manage Certificates
3.click + (Add) and select Apple Development
Clean Build Folder and run project
none of those actually worked for me. I had to delete the derived data; link, remove all the certificates and reinstall them, clean cache and had to reinstall pod files. After messing around for few hours I found a proper solution.
On Xcode 13.1 and received this error when attempting to archive my app, despite it building fine on the simulator. I didn’t have to change anything with my certificates in the keychain, just cleaning the build folder worked for me.
Open “Product” menu
Select “Clean Build Folder”
Build / Archive your app
I’ve seen some other answers reference which certificates they’ve had, so I’ll just add that I also have the 2030 “Apple Worldwide Developer Relations Certification Authority” cert and the old one is still in my keychain as well, which I’ll probably need to delete at some point.
In addition to the other answers, make sure that if you are sudoed to root, exit out before you try to codesign, so that you are signing as the login user. My codesign was failing when I forgot that I was running as root.
It work for me:
macbook air,m1 2020
delete old root CA(if existed): Apple Worldwide Developer Relations Certification Authority
reinstall root CA from certificateauthority,and double click to intall.
reinstall yourself cer. example: Apple Development: XXX Tang (9DHXXX87D)

Xcode 8.3.2 signing errors

I have Xcode 8.3.2 on Sierra. I am trying to build an Enterprise .ipa (have Enterprise membership).
I am having issues signing my app. Specifically in Xcode I have the following under General\Signing:
Automatically manage signing is enabled
Team: "My Team (Enterprise)"
Provisioning Profile: Xcode Managed Profile
Signing Certificate: iOS Developer
Status
Failed to create provisioning profile "com.myapp" cannot be registered to your development team. Change your bundle identifier to a unique string to try again.
No profiles for 'com.myapp' were found. Xcode couldn't find a provisioning profile matching 'com.myapp'.
My steps were:
Logged into Enterprise account at https://developer.apple.com/account/
Under Certificates, Identifiers, and Profiles I selected the Add
Selected In-House and Ad Hoc
On my MAC in the Keychain Access I selected KeyChain Access\Certificate Assistant\Request a Certificate from a Certificate Authority
Saved to my desktop
In https://developer.apple.com/account/ I uploaded the certificate signing request
I see it as a certificate as type iOS Distribution with and expiration date
I download the .cer file and double click on it to install it
Within Xcode\Preferences I find the Team under the Apple ID and under Manage Certificates I see iOS Distribution Certificates and Enterprise with today's date
I select the Download All Profiles for that team
In Xcode I select General\Signing and "My Team (Enterprise)
At this point I get the two errors described above.
I am new to Xcode development so I am sure there is something wrong with my steps.
Any insight would be greatly appreciated.
Well the solution to my issue was to do the following:
In Xcode under the "General" tab to disable Automatically manage signing
At https://developer.apple.com/account in my enterprise account under provisioning profiles I created a new distribution profile
Downloaded the profile => .mobileprovision file
Double clicked on the .mobileprovision file
With Automatically manage signing disabled I then selected the Provisioning Profile I just created and downloaded in the drop downs for Signing (Debug) and Signing (Release)
At this point I was able to archive and export an enterprise .ipa
This is the solution to my issue that's similar to this one:
Change your bundle identifier to a unique string to try again.
Your bundle identifier is already in use by other developers I guess, so just change your bundle identifier in the Identify tab right above your Signing tab to another one:
For example:
Bundle Identifier: org.react.native.example.RamenForLifeIn2022
Hope this helps :)

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.

Application failed codesign verification during validation in Xcode 4.2

I am experiencing trouble with the distribution provisioning profile.
I have tried for many times to create a distribution provisioning profile using the instruction: http://developer.apple.com/ios/manage/distribution/index.action
But when I verificate the program I get an error:
Application failed codesign verification. The signature was invalid, or it was not signed with an iPhone Distribution Certificate.
I have done the steps as follows:
1.I have created certificates in key chain access.
2.I have created provisioning profiles in iOS Provisioning Portal
3.I have created an application ID
4.I have set provisioning profiles in the Code Signing section in Xcode
Besides, I have checked that there are no duplicate or out dated certificates in key chain access.
I have looked through stackoverflow and have not found a solution.
What can be the problem?
Please check if you have done this:
1) one Development Certificate in the iOS Provisioning Portal
2) downloaded the Development Certificate onto your Mac and installed it in on your Mac (open it, after download it, so the keychain will open and you see the Development Certificate
3) Check if in the iOS Provisioning Portal exists a Provisioning Development Provile, signed with the Certificate you added in step 2(above) in the Keychain).
4) Have you used a wilcard for the AppId, or added you a String? Under Provisioning Profiles under the row App Id there is a String like this: **********.text. If you have something like this CD8V98ZN8M.* (first characters bevore the . are different, but the star after the point is important, then you can sign with this Provisioning profile every app. If there is something like this: CD8V98ZN8M.appname, then your Bundlename set up in your Target in xcode must be exacrly appname.
5) did you download the Provisioning Profile and installed it in Xcode by moving the provisioning Profile onto the Icon?
6) Try to rebuild after made a Clean, if it still fails check the Code signing Identity under Bild Settings in your Application Target in xcode, what and select your Development provisioning Profile and then make a Clean and try to rebuild.
But also check out this Question: How to solve "Application failed codesign verification" when uploading to iTunes Connect?
I solved my own problem. One old version of XCode 4.2 has a bug with codesign verification, so i've just updated XCode 4.2 to newest version and my app succeeded verification. Thats it! Always check for updates! =)

Resources