XCode is unable to create a distribution signing identity - xcode

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.

Related

Xcode iOS Development signing identity

I have a problem getting a iOS Development signing identity into Xcode. I have tried loads of things to get it working but I keep failing.
I have went the automatic way and let Xcode do it all but I kept going in circles where Xcode kept saying:
No signing identity found. Xcode can request a new iOS Development
signing identity for you.
Followed by:
Your account already has a valid certificate. If you have your signing
identity on another Mac, you can import a developer profile. You can
also revoke the current certificate and request one again.
I have done many steps:
Removing my account from within Xcode's preferences.
removing everything from the key chain app.
clearing everything from within the developer member center (apple developer website)
removing all provisioning profiles
removed my device
revoked all all my certificates
restarted Xcode to perform a 'Clean' project from the Product menu.
even went into my project.pbxproj file to clear anything related to PROVISIONING_PROFILE
removed all provisioning profiles from my device.
After this I went back into Xcode:
added my account into the preferences section
clicked View Details
did a refresh
Xcode automatically creates two certificates
Xcode automatically creates provisioning profiles
Xcode only creates a single Signing Identity: only for iOS Distribution.
This is my problem: I can not get an iOS Development signing identity.
After not getting it to work I went the old fashion manual way:
first clearing everything like the above
created new certificates manually, downloaded them and added them to the key chain app.
created new provisioning profiles manually, downloaded them and dropped them onto the xcode app icon.
At the end the result is the same; When I am in Xcode > preferences > accounts > view details:
I do have a distribution signing identity
I do NOT have a development signing identity
When I click the + button under the Signing Identities and choose 'iOS Development' nothing happens..
I have found lots of posts here on StackOverflow, I tried their suggestions but it won't work for me. Examples of other posts:
here, here and here
I am working with the latest version of Xcode: 6.2.
I am working on an app which is already in the App store.
Edited:
I have also changed the code signing build settings of my project and target into Don't code sign and put it back to iOS Distribution for ad-hoc and iOS Development for Debug.
Together with a very helpful person on the Apple Developer forums we have tried to figure this out.
I was so blinded by it not working, it never came to mind to try out and build another project and to see if that would work. I was completely focused on my certificates and profiles within the member center and my account details within xcode.
When I did try to build another (random) project, it worked in one go. This told us it must had something to do with the Build Settings of that one specific project which xcode could not code sign.
At the end, in xcode I went to the Build Settings of my Target. Within the Code Signing section I changed the values of Any iOS SDK to point to a specific Identity in my Keychain instead of having them on automatic (iOS Developer / iOS Distribution).
This fixed my issue and I was able to build/deploy to my device and I was able to upload a new build to iTunes Connect.
It takes a long time, and we did all the above solutions and they didn't work at all so our team decided to remove Pod files and run pod install again. finally, our OTA uploaded ipa installed on the user's device.
best Solution
clean project menu > Product > Clean Build Folder and /Users/{you user name}/Library/Developer/Xcode/DerivedData
go to your project directory and remove Podfile.lock ,Pods
folder,pod_***.framework
run pod install again
Brabbeldas, did those build setting changes end up getting the iOS Developer certificate showing in the Xcode > Preferences > Accounts > (your account) > View Details > Signing Identities pane?
There was a transient certificate generation issue resolved yesterday (March 26) at around 2:30PM PDT which restored missing Organization Unit fields to iOS developer certificates that also exhibited this symptom (missing developer certificate in the accounts > view details > signing identities pane).
If it's still missing you are probably still affected by this problem. To confirm, double click your iPhone Developer certificate in Keychain Access. The issue is still present if the certificate is missing its Organization Unit field. If your Organization Unit field is present, you're fine. The Organization Unit should be set to the value of your Team ID.
The full symptoms of this problem are:
iOS Developer certificate either shows as Revoked, or doesn't show at all in the Preferences > Accounts > (your account) > View Details > Signing Identities pane.
frameworks signed with the certificate fail to load with dyld: Library not loaded: [your_signed_framework]
Since the certificate server issue is now fixed, resolve the problem with:
revoke affected developer certificate on the website
click the "⟳" button in Xcode > Preferences > Accounts > (your account) > View Details
regenerate any custom developer profiles on the website, download and install those into Xcode
As an additional way to diagnose the problem with signed frameworks, use codesign -dvvv your_signing_framework.dylib. The TeamIdentifier field will be not set for affected certificates instead of your Team ID.

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.

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! =)

Taking over an Xcode iOS project: code sign error

I've been asked to take over an iOS development project, and was sent the project files.
I manage to run the project on the simulator, but when I try to run it on my own iPhone, I get an error saying:
Code Sign error: The identity 'iPhone Developer: former developer name (XXXXXXXXXX)' doesn't match any valid certificate/private key pair in the default keychain
How do I take over the project and run it on my own hardware?
Thanks.
You need to add your own developer certificate to xCode. If you've done that and it still doesn't work, I've had success manually removing all references to previous provisioning profiles and developer certificates by opening the xcode project file in a text editor. Normally you don't have to do that, but sometimes it's the only way I've been able to clear out a problem. See: provisioning profile hell

Resources