Code Signing Error - ios

The company I am working for has a base app that they reskin and sell to different businesses. I have redesigned the app and am trying to upload it to their account but am getting:
[BEROR]Code Sign error: The identity 'iPhone Distribution' doesn't match any
valid certificate/private key pair in the default keychain
How do I add their developer account into my Xcode and acquire a certificate for distribution?
Thank you

Basically, you need to have maximum privileges in the Provisioning Portal to do the following, so if you don't, get it, and then do this:
Login and download a developer certificate. If you need to create one, select How To from the menu in the Provisioning Portal under certificates.
Download a distribution certificate. Again, if you need one, select How To.
Open both certificates and make sure they open in your Keychain Access
Select provisioning and download both a developer and distribution .mobileprovision provisioning profile. Create one if necessary using How To
Make sure you have XCode open and open both .mobileprovisioning profiles. Make sure that they open in the Organizer and show in the status that they are properly linked with a certificate that is valid in the Keychain Access. If they aren't, a flag will pop up, saying something like "There is no valid certificate associated with this profile" in bright red.
Check your code signing in both the Target and Project areas of your build. Make absolutely sure that both are trying to sign using your distribution profile.
Make sure that you are building the distribution scheme of your app (You may have to create this).
Finally set the build device to iOS Device, set the scheme to Distribution, and select Archive. It is imperative that when the program asks you to allow the code signing to use your private key, that you select "Allow" and not "Always Allow," as this is very buggy and often results in code signing errors.
If you need any more help, comment.
Hope this helps!

Related

XCode unable to recognise the distribution profile present in my keychain

In a nutshell:
I got a distribution profile in my keychain (image 1)
From XCode developer account preferences I see only the developer profile (image 2)
When I try to add a new iOS distribution profile it says that I already one and that I should visit the member centre (image 3)
I did so and this brings me back to step 1
Infinite loop (aka "I'm stuck here as I keep retrying..")
EDIT: When I try to use the iOS mobile distribution profile that I generated I don't see many options for the code signing identies. This is how it looks like:
I have downloaded the team distribution profile on my computer from the apple developer member centre. This is the way it looks in my keychain:
However when I try to sign my code for ad hoc distribution I cannot find the distribution certificate in the code signing identities tab.
I manage to build the product archive (for local ad hoc distribution, e.g. TestFlight) but when I try to export it (or submit it to AppStore) I get a message saying that I already have a code signing identity and that I need to download it. More details on this in this question that I asked yesterday.
Today I am trying a different approach and I decided to go to the Account->Preferences and try to click on the "+" button to add a new iOS Distribution profile. This is what I get as response:
Unfortunately it seems that XCode is unable to recognise the iOS Distribution profile that I have installed in my keychain (see beginning of this question) whilst unable to recreate one.
How can I fix this without messing up the certificates/apps of my team members?
Install both valid certificates in your system (Distribution and Developer)
By looking at your Keychain screenshot, I can see that the Certificate lacks the little disclosure triangle next to it. What this indicates is that although you have the distribution certificate, you lack the private signing key. Without it you will not be able to sign the app and it is why you're stuck in this loop.
If you were the person that created the CSR (Certificate Signing Request) when setting up the Distribution Certificate, you should have the private key already in your Keychain - in which instance it may be the case that you are using a couple of different Keychains (e.g. I have the login keychain as well as my Development keychain), the private key is actually in a different keychain to where your distribution certificate is.
In this instance you will simply need to move either your Key or Certificate into the correct keychain for it all to marry up.
Alternatively, if you were not the person that created the Distribution Certificate in the first place, you will need to have the original user export the Key for you using Keychain or by having them export the Developer profile using Xcode.
Pls check if your keychain is missing the private key associated with distribution certificate.
Here is a similar thread that you may wish to take a look at : link
good luck!

Error while refreshing profile in XCode preference

I tried to upload my app in itunesconnect, i am doing the following steps,
i set correct bundle-id
code signing identity - iOS Developer
provisioning profile - Automatic
in Xcode preference, while clicking on the iOS distribution under + button, i got the following error.
"Your account already has a valid iOS Distribution 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."
Try the following:
Download all your certificates and profiles from the Apple Member Center and save then somewhere you can access them.
Double klick all of them, that should bring up Keychain as well as Xcode
In Xcode, open your project's build settings and set the Code Signing Identity under Developer to your developer certificate and the corresponding certificates to Distribution.
that should be it, check Xcode's preferences for the certificates and profiles to make sure they're correct and it works.
Hope that helps :)
Apple has good and complete documentation:
Step-by-step guidance for enrolling in an Apple Developer Program and building, testing, and submitting your app.
You need to be an admin or agent to make a distributable build.

can't resolve "valid identity is not found"?

I'm trying to develop my first iOS App on my mac (OS 10.8), the application contains a push notification service. I followed the below steps to create my App ID:
Give a name to the APP ID
Set the Bundle ID.
Check the Push Notification checkbox
Create App ID
Generate a certificate, by uploading the request created by key chain access, then downloading and installing it on key chain access, exporting into .p12 file.
Create Provision Profile, Download and install on my Xcode organiser (XCode 4 updated version) and on my device to test.
The project work well on the simulator (except get the token and that's normal). However when installing the provisioning profile on the Xcode Organizer it gave me :"valid identity is not found".
Checked and tested Many Solutions:
Delete Cert from Dev Center and Key Chain Access.
Delete Provision profile recreate it.
Install provision profile directly from Xcode.
Delete Created Keys from key chain and create new ones.
Many suggestion has been provided:
Your Keychain is missing the private key associated with your iPhone Developer or iPhone Distribution certificate.
Your Keychain is missing the Apple Worldwide Developer Relations Intermediate Certificate.
Your certificate was revoked or has expired.
Online Certificate Status Protocol (OCSP) or Certificate Revocation List (CRL) are turned on in Keychain Access preferences
None of the above fixed the problem.
Would you please provide a solution for this problem and thank you in advanced.
i had discover my problem. i work in a company and there is my partner have generate the developpements certificate on his own mac. i work on a different mac. so what i need, he must export the key and the certificate from his key chain access and give it to me.
that's it.
beginner's problem :d
First of all make sure your Bundle Identifier match with the bundle Identifier included in the provisioning profile. And you have correctly added your iPhone's UDID to the developer account under devices and then add the bundle identifier and device to the provisional profile. Also make sure you have requested the certificate from your own Mac and then installed the certificate after downloading it from the developer account. And there will be a key under your certificate.
Many things may go wrong, so simply try these steps, even if you've done them before.
Make sure your Bundle identifier is the same at both in Xcode and in iTunes Connect, it's a good practice to fill it manually instead of Xcode's template, as it IS case-sensitive.
Check that your testing device's UDID is listed on the Devices list at developer.apple.com.
Create a new provisioning profile with a new unique name, for your app's bundle ID, make sure, again, that it's the same bundle ID (case sensitive) and make sure you have your newly-added device UDID (or the existing one if you had it correct before) in on the provisioning profile. Take a note of the developer certificate that the provisioning profile is bound to.
Download the newly created provisioning profile AND the development certificate that the provisioning profile is for. Clean your project's build folder (open Product menu from the menu bar, press and hold down the option button on your keyboard, and select 'Clean Build Folder...', exit Xcode.
Open both your provisioning profile and certificate. One should open in Xcode, the latter, in Keychain access.
In Keychain access, make sure you have the private key to your non-expired, non-revoked developer certificate. (if not, you need to either find its private key (e.g. in another keychain or in another Mac. It should be on the Mac that the CSR is created on, or if none are available, revoke it and create a new certificate, and start over this process)
In Xcode, make sure you are using the provisioning profile, NOT overriding it (e.g. you've selected a different value under 'Debug' or 'Release' options by mistake).
In Xcode, make sure you are using the correct development certificate (the one that is bound to the provisioning profile) and not overriding it under Code-signing identity section's Debug or Release, or in 'Any iOS SDK' sub-item underneath them. If everything worked, Xcode should offer you the correct certificate for your provisioning profile.
Your project should build. Seriously, I can't think of anything else.

XCode doesn't honor the "iOS Distribution" Code Signing Entity setting

I want correctly understand the Code Signing Identity setting: I want to use the automatic setting in Xcode and not specify a specific identity. The automatic setting has 2 choices: iOS Developer and iOS Distribution. Based on which one you use, it's supposed to switch to choose a developer or a distribution signing identity from your keychain.
I have my build settings configured as follow, in order to use an "iOS Distribution" identity on build:
When I Archive my app (the Archive scheme is correctly set to use the Release build configuration), I see that Xcode is not using the correct code signing identity:
Anyone would know why this is the case? I'm looking for an explanation and not a workaround solution (I know I can work around the problem by directly setting the Code Signing Identity to my iPhone Distribution: Company Name identity from the keychain)
Thanks!
So interestingly this doesn't actually matter in the latest Xcode as long as the profile you are eventually going to sign with is for the same bundle identifier as the one its signing with now...
As long as the team setting is set Xcode is capable of generating the profile you need automatically. Don't try to fight it.
Here is the Team setting from the Target's General settings screen:
Then when you archive Xcode puts the archive in the organiser. When you click distribute on the archive in the organiser window it prompts you to select a new signing identity and actually re-signs the app.
It actually works to sign apps with the team provisioning profiles generated by Xcode. You also don't need to make an ad-hoc specific provisioning profile as your testers can now install apps signed using the development provisioning profiles with no issues. The only time you will need to make your own provisioning profile is if you are using any of the concrete bundle id features like push notifications, game centre, data protection, iCloud, inter-app audio, passbook, keychain access groups or in-app purchase.
If you make your own provisioning profiles for specific bundle ids then Xcode will either automatically select, or have available for selection, the relevant provisioning profile at the point of choosing the identity in the organiser window.
You can refresh Xcode's cache of provisioning profiles from the Accounts pane of Xcode's settings. Click on your team, Click "View Details" and then click the tiny refresh button in the bottom left corner

How can I download identities without Xcode crashing?

I am working on my first app submission, and at present Xcode's Organizer tab offers "Validate..." and "Distribute..." buttons, but not "Submit..."
When I go to click Validate, it indicates a probable cause: I do not have any (downloaded) signing identities to sign with. I am offered the option to install an identity, but when I select the (one) available identity and click "Choose", Xcode crashes.
Are there any workarounds for this, or things where there might be a wire crossed on my end? Is there a more stable release of Xcode (I'm using 5.0, 5A1413)?
Thanks,
You'll want to go into the iOS Dev Center and create a Distribution provisioning profile. Once that's created and downloaded, it should get rid of the 'No signing identities' issue, which will prevent the crash. (I've had XCode crash there for me as well when I didn't have that set up)
Also, you'll actually never see a 'Submit' button; 'Distribute' does everything you need.
High-level concept:
Xcode 5 has a validation and a distribution button on the Organizer window > Archives Tab. Occasionally when trying to access this area or sometimes when attempting to choose a signing identity or provisioning profile (under Preferences > Accounts) one will encounter an error. These errors are typically related to an invalid date associated with a certificate. The certificate might be associated with the provisioning profile or the signing identity.
To fix this type of error one should try the following:
Login to the Developer Portal
Access your Certificates depending on type of app being submitted
(iOS, Mac, Safari extension)
Make sure that you have a valid distribution certificate (under
Production)
Make sure your App-ID is configured (consider using a wildcard)
Make sure your provisioning profile (distribution) is set and that it is
using a valid certificate
Make sure the expiration dates are correct on each certificate you are using
Download your certificate and provisioning profile to your desktop
(double-click to install)
Make sure you select the correct profile (Build Settings > Search
Profile.. > Edit Provisioning Profile)
Make sure your code signing identity is set to your automatic
distribution for your release code (Build Settings > Search Code
Signing Identity > Edit Release Setting to Automatic - [iOS]
Distribution)
What to do next:
Xcode should pick up the changes at this point so try your validation again (Organizer > Archives)... Assuming you are past validation you can distribute as needed. If any problems at this point open Spotlight > Search for Keychain > Evaluate the Certificates in your Keychain on your development environment to ensure that you have the correct certificates installed. If you have questions or issues beyond this, please consider reviewing the official app distribution guide. If this answer fits your use-case please consider accepting so that other users may find the proper solution.

Resources