Valid signing identity not found - works on one machine, not the other - ios

I realise this is a common problem that people bump into, but I'd trawled all the answers I can find but have seen nothing better than "wipe everything, start again".
I'm hoping to do a little better than that. The problem is, I can only ever get my iOS provisioning to work on a single machine. I set it up on my Macbook Air and it stops working on my iMac. So I follow the 'wipe it all' including revocation of certificates and start from scratch on my iMac and it works, but breaks my Air.
There must be some fundamental piece of the jigsaw I'm missing.
I have downloaded and installed WWDR certificate.
I have downloaded and installed my developer certificate.
I have downloaded and installed my distribution certificate.
Everything should line up. I have all of my profiles in place, but they say "Valid signing identity not found".
What certificate is missing? What represents the signing identity? What is it that exists on one machine that doesn't on the other?
I'd really like to understand this and solve it properly.

I am not that clear on this concept too but i think the problem is that you dont have the proper certificates in your keychain access.
If you open up your keychain then you will find the private key certificate in one of the keychains on the left panel.
You will have to export the private key to get a .p12 file that you can open in other machines and download the .mobileprovision from the developer website to make it work on different machines.
Shout if anything is not clear to you.

Related

How to retrieve original iOS distribution certificate from original Mac to fix "Your account already has a valid iOS distribution certificates"

I'm kind of new in this Apple certificate and provisioning galore, and also don't really understand much about keychain. What I've learn from this error is that I need to get the original team certificate from the original Mac which create the team certificate, export it, and import it to mine.
The only problem is: which certificate? I have my own team dev certificate, so I guess I want to draw parallel comparison. But when I tried to open my own the keychain, I'm presented with tons of keys that I don't know which one to export. And now, I need to give instruction to people on the remote location on which certificate to export, but how I'm supposed to give instruction if I myself don't know certificate with which name to export? The other guy is also don't know so much about certificates too.
All this time, I always use "reset" or "revoke" certificate to resolve this problem. But I know that's not the correct way because the certificate on the other computer will be invalid then. Because this is a different team, I cannot use the "revoke" tricks here. How can I do this the correct way and point the other guy which one to export? What is the hints that usually give signs that this is the correct certificate to export?

Xcode messing up with certificate identities and multiple team ids

When building my App (for Archive) I get:
You have a valid iOS Distribution certificate in the Member Center,
but it is not installed locally. If your signing identity is installed
on another Mac, you can export a developer profile on that Mac and
import it on this Mac. You can also revoke your current certificate
and request a new one.
The Apple documentation suggests that its because I just moved computer. See link here.
However I haven't just moved computer. I am simply trying to upload my build to iTunes connect.
My email is associated to two developer profiles that are both installed on my Mac and hence I believe that Xcode its confusing itself by believing that I have already a profile installed.
For this reason I created a new distribution profile from the member centre, one for App Store distribution and one for ad hoc distribution. I then dowloaded it and clicked on it. Despite having done so it does not work.
When I click on Fix issue I get the message quoted above.
I tried to refresh the details in the Accounts sections of Xcode preferences, but was not of much help.
I believe Xcode is messing up with the team ids.
Is there a way to solve this without revoking and requesting a new certificate?
And if not what is the best way to fix this?
I would try downloading and installing the certificate from the portal. Then open the KeyChain app and see whether it appears under "My Certificates" section. If so, that should fix your problem, though check to make sure you don't have duplicates. If it does not appear, then it means you don't have the private key, and it will not be useable unless you can import the private key. You probably need to revoke and create a new certificate.

"The private key for ... is not installed on this Mac" – distribution and provisioning profiles in Xcode

I've tried looking at the other answers for this but there's a lot of incomplete or conflicting information, but if you have a good link that would be great.
When I try to distribute my app I get this error:
I've tried creating a new distribution profile from Certificates, Identifiers & Profiles at developer.apple.com, but none of these seem to work.
I have a Time Machine backup from before I did a clean install of Mavericks to upgrade, and I also have a code saved to a text file in my Dropbox (I'm not sure if it's a private key – I doubt it) which looks like 'df9a79...' around thirty characters long.
I just can't seem to find the right link to guide me through the entire process of key creation, iTunes connect and developer.apple.com. I've done this before – I'm currently just trying to submit an update to the App Store.
My app update status is currently Waiting For Upload.
Here is my Keychain:
I've tried removing duplicates (e.g. those in the first screenshot), but that didn't seem to help. If you have any suggestions or links I'd love to hear them.
Thanks for your help.
In your keychain, there are two keys named 'Matthew Palmer'. Those two entries for the same name can be conflicting. Try by removing those both and install it again.
I hope you make a Distribution Provising Certificate at developer.apple.com.
Chose that profile there , if you are not, create that, first you need to create that certificate before proceeding.
I had this problem and eventually realised that I'd originally installed my provisioning certificate on another machine. The private key was only on that machine, and there was only a public key on my new machine. I needed to install my private key on my new machine so I could sign my app and submit it.
On my original machine, I went to Xcode>Preferences>Accounts and used "Export accounts" (under the cog) to save a copy of my accounts. I transferred the generated .developerprofile to my other machine and dropped it on Xcode there. That installed the private key for the provisioning profile on that machine and I was able to submit my app.
Another resolution to this is restart Xcode. I had the same issue after creating a new provisioning profile, and after restarting Xcode I no longer had the issue.
After experiencing this error, I tried submitting to the app store via Application Loader, signing the app with my AdHoc certificate instead of the app store certificate, as that one didn't generate the same error.
The submission was accepted by Apple with no validation errors.
This is a temporary workaround, but it may be helpful if you need a quick submission.

Certificate identity 'iPhone Developer: ' appears more than once in the keychain. The codesign tool requires there only be one

Ok, I am completely pulling my hair out on this one.
Back in July I created a provisioning profile so I could test on my iPad.
Then at the end of August I tried submitting my first App to the iTunes Store. The process was a complete nightmare, and I struggled. A lot. In the end I found a tutorial with relatively recent information in it, and only by following it step by step could I actually get anywhere with this. Unfortunately the result of this was that I created a new provisioning profile.
Now when I try to test on my iPad I get the following error in Xcode:
Certificate identity 'iPhone Developer: MyName' appears more than once in the keychain. The codesign tool requires there only be one.
I check the keychain, and sure enough there are the two provisioning profiles for development, one from July and the one I used to submit to the iTunes Store in August.
Now what I want to do is get rid of the old one, and then connect my iPad up to the new one. I can get rid of the old one fine, but I cannot connect my iPad to the new one, it insists on using the old profile, even to the point of re-attaching it to the keychain after Ive deleted it.
Can anyone tell me:
How to connect my iPad to the new provisioning profile?
And while we are at it, can anyone shed any light on why this entire process is so convoluted and difficult? Considering that so much of Apples interface is so well designed and fluid, this process of registering certificates and applying them to different devices and Apps seems so backwards. I initially suspected this was just me, but googling for these error messages reveals that there are many who are struggling at various points along this process.
This has nothing to do with Xcode and everything to do with keychain.
Open keychain.
Find the signing certificates that are tied to your provisioning profiles.
Delete one. You probably want to keep the newer one, so look at the expiration dates and remove the one that expires first.
Restart Xcode
You may need to update your provisioning profile if it isn't tied to the new certificate, but it won't be as painful as creating a new certificate.
Here's a broad overview of how code signing in Xcode works. It a bit much but will explain what's wrong with your configuration, and how you can fix it.
There are three parts to the mechanism that ensures that you are who you say you are and that your app is allowed to run where it wants to.
You've got a pair of keys, one public and one private. Your public key matches your private key, which identifies you.
Your keys are used to generate certificates. Generally, you'll have one certificate for development and one for distribution,either on the App Store or via Ad Hoc distribution. These certificates permit you to provision your apps.
Each certificate is used to generate provisioning profiles. The profiles must be attached to either a development or a distribution certification. A distribution profile either works on the App Store, or it contains a list of device IDs which may run apps signed with that profile.
If your certificate is expired, the provisioning profiles that are created with it are going to be invalid. In this case, replace both the certificate and the profiles. Generate a certificate signing request (CSR) from Keychain Access and upload it to the developer portal.
If you have multiple certificates in your keychain, Xcode won't know which one to use. This may happen if you renew your certificate and don't remove the old one. (It may also happen if you exported your developer profile and then imported it later. Your old certificates will carry over.)
If your provisioning profile is expired or invalid, you can renew it in the developer portal without generating a new CSR. You can just attach it to an existing valid certificate.
Certificates can't be carried over from one machine to another without moving the original key pair that requested it. Exporting the certificate from Keychain will export the keys as well.
Delete the old one, and start build with new.
One more way you can try , set code signing identity with profile you want to run in both target as well as project build setting.
Hope it will help you.
Otherwise you have to delete old one.

Xcode Code Sign error because of no Keys in Keychain

You might think, not again such a question where are already thousands of topics about. However, I've not been capable of finding the answer I needed to fix this problem.
None of these topics go as deep as the Keychain.
When I'm trying to deploy my app to an iPhone, I'm receiving the following message:
Code Sign error: The identity 'iPhone Developer: [Name] ([ID])' doesn't match any valid, non-expired certificate/private key pair in your keychains.
Now, as said, I have been looking for multiple guides or fixes, however, none of them seemed to fix this issue.
Things I've tried:
Use Apple's walkthrough for app deployment for countless of times
Searched the internet for guides for app deployment
Changed the content of the 'pbxproj' file inside the 'xcodeproj' package.
Retrieve all available profiles from Apple's server using the Refresh button in Xcode 4.6 (allows you to obtain automatically)
After trying all of these ways, I've still not been able to solve the issue. One problem I've seen is that at first hand, the certificate in the Keychain was showing an invalid status, which is now solved.
However, if I'm right, there are supposed to be two keys attached to the certificate. A public and private key, and these are not showing.
Neither are there any keys showing in the Keys tab in the Keychain Access.
Solution
(Thanks to nsgulliver)
Do everything what the post (marked as Solution) of nsgulliver says.
If you already have an active Certificate, click the Revoke button, this won't cause any trouble, you'll simply have to re-create the keys of which then will be generated a new certificate.
Make sure you have the WWDR of Apple installed to mark the certificate authority as valid.
Follow the default Provisioning Assistant guidelines.
Provisioning profiles installed on the devices or signed with for the target might not be valid, try to go to Organizer->Provisioning profile and see if the profiles have the valid status? if not try to delete & refresh them, if they appear valid after refreshing then it might solve your problem if not then you should remove all the entries from keychain and delete profiles on your provisioning portal and try to create from scratch, if you still face the problem then take help from step by step guide tutorial
You cannot re-create matching keys, that would defeat the whole purpose of them. You need to find the old keys or start the signing procedure from scratch.
Are you using the same machine that you generated the keys on? If not, go to the other machine, export the developer profile, then import it on the new machine.
Can you restore the keys from backups? If not, stop everything you are doing and configure your computer for backups before you do anything else.
If you are really stuck, you will have to follow the signing procedure right from the very beginning, where you request a certificate from a certificate authority. This will generate new keys, and you will have to create matching provisioning profiles, then set your application to be signed with these. Dlete the old provisioning profiles, they will be useless without the old keys.
You need to lock keychain. Please see screenshot:
Required reading when you're having code signing problems:
Technical Note TN2250: iOS Code Signing Troubleshooting
Nothing will help you more than really understanding what's in your certificates and what isn't, where the necessary pieces are kept, and how they're used. This isn't the last time that you'll have code signing issues, and this tech note provides a long checklist that should help you make sure that everything is in the right place to help you develop your app and ultimately sign and submit it to the app store.
When I've had this problem in the past I've just deleted everything on my local machine and started again. So:
Delete the keys associated with your developer account in Keychain access.
In XCode open the 'Organizer' (window->organizer)
In Devices (top menu) and Provisioning Profiles (left menu), select all of the profiles and delete them.
Now hit refresh. It will ask you to sign in and whether you want to generate new keys etc, select yes and wait.
I find that this is the quickest way to fix any provisioning / key problems, as you can spend hours finding that you've missed something small.
After removing all old provisioning profiles (~/Library/MobileDevice/Provisioning Profiles/) and updating xCode, the certificates can be found again.

Resources