Code Sign error: The identity 'iPhone Distribution' doesn't match any valid certificate/private key pair in the default keychain - iphone

XCode is giving me the above error. This is my first experience with, what I'm assured is, the "easiest platform to write code with, ever".
The response in Code Sign error: The identity 'iPhone Developer' doesn't match any valid certificate/private key pair in the default keychain of making sure the "Debug" and "Release" (which I assume means "Distribution") are the same did not help.
I don't see a program portal portion off http://developer.apple.com on signing in, as I should according to Code signing error: Doesn't match key pair in default keychain.
I also found https://webbuilders.wordpress.com/2009/12/25/code-sign-errors-profile-doesnt-match-any-valid-certificateprivate-key-pair-in-the-default-keychain/ whose steps I followed and it still doesn't want to build.

Welcome to a special new bottomless source of frustration! Coding for iOS is great—once you get the hang of it, Objective-C is a great language and UIKit has (for the most part) really well-built frameworks with clean, intuitive APIs. But using Xcode to get your code running on your device can be a miserable experience that tries your patience and sanity, presenting you with unintelligible, random errors for no apparent reason, even when the same thing worked yesterday. Believe it or not, provisioning (the process of signing your app with a developer key so that it's allowed to run on the device) isn't as bad as it used to be, because Automatic Device Provisioning takes care of a lot of the tedious setup bits now. See Technote 2250 for details:
https://developer.apple.com/legacy/library/technotes/tn2250/_index.html
Also, you did pay the $99 for the iOS Developer Program, right? You can't get a developer profile and deploy to your iOS device without that.

As stated ..i was trying to get a IPA file (for testflight.com) but without enroll int he developer program .... i got the same error. You need a certificate installed after enrolling.

Related

Yet another ERROR ITMS-90161: "Invalid Provisioning Profile"

Over the past couple of days I've worked my way through all the prior posts on here that I could find that seemed to be related (many of them appear to be horrifically out of date and less than useful now), as well as the Apple Troubleshooting and Maintaining Your Signing Identities and Certificate guides (not to mention the usual Internet searches).
The app in question was deploying fine until the latest XCode update, but now fails to upload (build is successful obviously, and there have been code changes as well):
ERROR ITMS-90161: "Invalid Provisioning Profile. The provisioning profile included in the bundle *content removed* is invalid. [Missing code-signing certificate]. A Distribution Provisioning profile should be used when submitting apps to the App Store. For more information, visit the iOS Developer Portal."
It's not the first time I've mysteriously had a failure like this, but in prior cases simply revoking the certs, removing the profile, then rebuilding would take care of it. Not so in this case.
The provisioning profile is confirmed to be the correct type, and the code signing certificate sure looks like it's in there... Certificate gets a nice green checkmark too. Any new suggestions not covered in the usual places?
It turns out that there's nothing wrong with the certificate itself, but it's the upload process which needs to be done different.
In the past I had been deploying the distribution outputs from Cordova CLI via the Application Loader. The App store no longer accepts my builds when done that way.
With the current version of XCode, I need to use the GUI now and set the build target to "Generic iOS Device" and then do an "Archive" operation. The archive will upload the app through a different loader, which the App store will accept.

Xcode says: "Identity ___ is not trusted." and won't allow me to submit my app

I've been living the nightmare of trying to submit an app to the iTunes store... The newest massive waste of time is an error message that I get when I try to validate or distribute my archive from the "organizer".
The exact message is:
My Xcode is version 4.3.2. I'm pretty sure my WWDR is installed, because this has never been an issue before. I also tried to re-install it just to be safe.
The most frustrating/confusing part is that I JUST submitted my app successfully two weeks ago and nothing was changed. My app was rejected for meta-data reasons. I fixed those issues, re-installed one of my plugins, and now this.
Any suggestions? Even a link to some helpful documentation would be great. I've found the Apple developer docs extremely confusing and UN-helpful.
EDIT1:
I think I may have gotten closer to the problem. I changed some of the build settings and now my build fails with this error:
Code Sign error: Certificate identity 'iPhone Distribution: [my name]' appears more than once in the keychain. The codesign tool requires there only be one. I want to fix this but I'm not clear on which code signing profile should be set where. There are different settings depending on whether I click the "project" icon or the "target" icon and each of those has four different choices. Do all of these require code signing? Can anyone give me an example of a working configuration?
EDIT2:
I think I maybe found the problem. There is a small note that says my Distribution profile has no provisioning portal. I've been downloading and installing new .mobileprovision files but they all say "Developer". I think just need to figure out to download a new distribution profile.
SOLUTION:
Thanks to some pointers from Saad (see below), I figured out what was wrong. I was using the auto-select option for code signing, and the only distribution profile had an invalid provisioning profile. This happened very quietly, and I'm not sure why. I only noticed it when I went back into the provisioning portal to create a new distribution profile. After installing this, everything works.
your provisioning profile is not properly set
Code Sign error: Certificate identity 'iPhone Distribution: [my
name]' appears more than once in the keychain. The codesign tool
requires there only be one.
Open Applications > Utilities > Keychain Access and search for your Distribution certificate. Sometimes the Xcode Organizer decides to generate a new certificate for you and invalidates your old one, but does not remove it from your keychain. Remove the expired/older certificate and quit/re-launch Xcode (make a backup first, in case, by dragging to Desktop or Exporting). That should at least clear up part of your problem.
As for the provisioning profile, if that still is a problem, I'd manually go into the iOS development center and download the App Store Distribution Provision Profile for your app, removing all other provisioning profiles, until you figure this out. Quitting and relaunching Xcode when dealing with certs/provisioning profiles is something I've always had to do.
project identifier and your profile identifier must match

iPhone developer doesn't match any valid certificate (Xcode)

Hi I've kind of been cornered by apple here, I submitted a technical support query, one of the free ones thats comes free when you pay into the developer program only to be told that they won't be in the office until after Thanksgiving, a problem I overlooked as I am from Ireland. I really need help on this as I've tried looking in forums and I've tried solutions that were given for similar problems but I still can't crack it.
The screenshot images can be seen on this page..
http://www.heffernanwebservices.ie/blank.html
Here it goes...
DESCRIPTION OF PROBLEM On trying to build my project "Mulligan IRL" in xcode i get the following error " Code Sign error: The identity 'iPhone Developer: Cian Heffernan (8ELM27DL8F)' doesn't match any valid certificate/private key pair in the default keychain"
[Screenshot 1]
When I navigate to code signing in the build settings of the project i can see that when I click code signing identity for iphone developer or iphone distribution it has "(no profiles currently match) beside them. I then headed to the keychain access window in utilities and look in certificates and find that both the developer and distribution certificates will not expire until next August and November. Next I headed to the organizer in xcode. I see in provisioning profiles I have 8 profiles there! I don't know why I have so many.(2nd attachment)
[Screenshot 2]
As you can see ONE of the iOS team provisioning profiles will expire in 11days so I just tried to renew that. When I try this I get an error:(3rd attachment)
[Screenshot 3]
I then head to the provisioning portal to see why it wasn't found but I can see the profile. (4th attachment)
[Screenshot 4]
I have no idea why I am getting this error. I would appreciate any help on the matter.
For certificate to be valid it needs to be associated in your Keychain with a private key. Find the "iPhone Developer..." certificate in your Keychain and see if it's got a private key associated with it.
This can occur when you develop on two or more computers. You need to export the certificate+private key pair from the computer where you generated the private key first. Then import it onto all computers you do development on.
See Apple's Transferring Your Identities for more detailed info.
This could be caused by not having the private key associated with your certificate in your keychain. You can verify this by going to Keychain Access and choosing "Certificates" from the "Category" area at the bottom left. If your developer certificate does not appear when filtering that way, you are missing the private key for it.
If this is the case, you'll have to add your private key to the keychain, or else just reject and re-issue your development certificate with a new private key (you can find steps for this in the provisioning portal.)
a useful link from Apple about the submission process. hope it helps
I was using AppCode, but for me simply adding a new Keychain via Keychain Access called iPhone Developer allowed me to start building in AppCode.
Apple has a great article regarding Certificates and Provisioning-Profiles,
with excellent troubleshooting:
iOS Code Signing Troubleshooting
The most useful part I found was regarding cleanup of old provisioning-profiles from Xcode:
"Keep Your Profile Library Clean
...You need to manually remove provisioning profiles you are not using,
otherwise, Xcode will reimport potentially old or duplicate certificates into the keychain
and that can cause build errors."
And as a weapon of last resort, you can use this procedure:
How do I delete/revoke my certificates and start over fresh?

I'm in an iPhone provisioning mess -- Insight needed

My app has been more or less ready to be submitted for a while now, but as usual, the overly complex provisioning nonsense that Apple forces developers to jump through is causing me an enormous amount of stress. Initially the problem I was receiving was Invalid Codesign. After trying every 'solution' i could find on the internet and failing, I decided that it would be best if I started fresh -- Deleted all my provioning profiles, cleaned up my itunes connect account, deleted all my keys and certificate from the keychain access and started from scratch. The problem is that once I deleted by keys and developer certificate from the keychain access, I cant get them back!!! I've tried restarting, I've tried installing it every way imaginable, but I just cant get anything to be listed in the 'keys' nor 'my certificates' sections of the keychain access. I do have an iPhone edveloper profile in the 'certificates section' but this doesnt even seem to be of any use because when I look in the Organizer there are no developer profiles listed, and all my provisioning profiles warn "A valid signing identity matching this profile could not be found in your keychain"
Someone please help me through this mess. I've been developing my app for several months now and I already have an app in the App Store but Apple insists on making this process damn near impossible. Thanks so much!!!
Your public and private keys are automagically generated when required - if you use the certificate assistant to request a signing certificate as the provisioning profile describes you will find your new private/public keys created.
Once you begin this process you should also use spotlight to remove all .mobileprovision and .cer files you may have remaining in downloads, and also use organizer to remove profiles from devices. If you are starting from scratch you want to make sure none of that stuff remains to cause you problems.
This is an overcomplicated process to be sure, but once everything is really deleted and a fresh start is made it should be good for some time. The biggest problems I have had are when getting a new Mac and having hiccups with exporting/importing keys in an effort to keep my old certificates/provisioning valid.

How do you solve the iPhone error "signature is valid but not trusted"?

Finally got MGTwitterEngine stuff to
compile (by setting the Header Search Paths to /usr/include/libxml2 iphoneos3.0/usr/lib/libxml2)
AND link (by removing the Twitter LibXML Parsers code and assigning a weak role to libxml2.2.dylib in Targets: Link Binary With Libraries).
But when I do a Build and Go to the iPhone (not the simulator), I get this error:
"This provisioning profile does not have a valid signature (or it has a valid, but untrusted signature)."
I have followed the official Apple Developer process of getting a certificate and provisioning, etc. Obviously, I did something wrong somewhere. Has anyone come across this problem or have any ideas on how to solve it?
Things to check:
In Keychain Access, make sure you have a code sign identity (public and private keys and a certificate titled "iPhone Developer: Your Name"
In your Info.plist, make sure your Bundle Identifier matches your App ID that you created in the dev portal
Make sure you installed the .mobileprovision (from Terminal> open x.mobileprovision)
In the dev portal, make sure your provisioning profile has your certificate, your App ID, and your device all enabled. If it doesn't, fix that and re-download and re-install your provisioning profile.
Follow the instructions very carefully when creating your Certificate. One time, in Keychain Access, when I went to Request a Certificate, I had something else selected in the list panel and so it created the wrong kind of certificate. Make sure nothing in the list is selected when you do this part.
Restarting Xcode may also work... (Work for me couple of times)
Troy It looks like the issue is you don't have a keypair that is tied to the provisioning profile installed. It's tough to tell for sure but that is my best guess.
If that is the case, I've been working in a similar situation - what you need is to either generate a private key using the iphone development portal under the same account your boss used and then add that new key to the provisioning profile you are building with.
OR
You can get your boss to export the key he generated when he created the provisioning profile - he can export it from keychain and give it a password that will allow you to install it but protect it from anyone else installing it.
I guess the fifth time's the charm. I basically deleted the certificate and the provisioning file, etc., and started completely over. Viola! Now for those pesky memory leaks! :-) Oh, Java, wherefore art thou, Java? (and your majic garbage collection!)
One of the things that I tried and worked for me was to reset the keychain access
http://support.apple.com/kb/TS1544