Why does my Xcode build keep failing? - ios

Any idea why I can't build my iOS app with Xcode? I've successfully built it for the simulators many times, so the app itself isn't the problem. When Xcode fails, it gives me this error message: "Code Sign error: The identity 'iPhone Developer' doesn't match any valid, non-expired certificate/private key pair in the default keychain."
Simple enough, right? But: In my login keychain, I have two certificates, "iPhone Developer: [My First Name] [My Last Name] ([alphanumeric ID])," and "iPhone Distribution: [Name of My Company]." Both expire in August 2012. "This certificate is valid," Keychain Access tells me about both of them.
In Organizer, I have three provisioning profiles: "[Name of Company] Distribution," "[Name of App]," and "iOS Team Provisioning Profile: ." All three of these have expiration dates in the future. They're all on the platform iOS Profile. The first two have an app identifier of [ALPHANUMERICCODE].com.[nameofcompany]., the third has an app identifier of simply [ALPHANUMERICCODE].*. But get this: All three have "Valid signing identity not found" under Status.
I've done a lot of searching and can't find any examples of anyone reporting both the certificates and the provisioning profiles being present but still being unable to build an archive in Xcode. Any ideas?

This is a problem with keys. In keychain access, there is a section called keys. I'm thinking you are missing the keys that were used to sign your provisioning profiles.

Related

Xcode is not selecting the correct certificate when signing an application

One of my iPhone Distribution Certificates is about to expire soon.
I've generated the new Certificate with the same teamID and the corresponding Provisioning Profiles for a specific application. The problem I have, is that the old certificate is still used by some other applications in the same group.
The signing process is done through a Jenkins job, which executes a fastlane lane. Until now, Xcode, when exposed to the 2 valid certificates, is always choosing the newest one, which causes applications that are still using the old certificate to fail (signing error):
error: Provisioning profile "xxxx" doesn't include signing certificate "iPhone Distribution: xxxx". (in target 'xxxx' from project 'xxxx')
"xcodebuid --help" yields the following text regarding ExportOptions.plist parameters:
signingCertificate : String
For manual signing only. Provide a certificate name, SHA-1 hash, or automatic selector to use for signing. Automatic selectors allow Xcode to pick the newest installed certificate of a particular type. The available automatic selectors are "Mac App Distribution", "iOS Developer", "iOS Distribution", "Developer ID Application", "Apple Distribution", "Mac Developer", and "Apple Development". Defaults to an automatic certificate selector matching the current distribution
method.
If I go to ExportOptions.plist and crete a key to force the SHA-1 (or even the certificate name), the error still appears.
While signing, is it possible to use the ExportOptions.plist file to uniquely identify a specific certificate, when both exist on the same keychain?
Any additional hint which I might have not be aware of?
Thanks in advance
Technological Stack:
Xcode 11.1
MacOS 11.4 Big Sur

Multiple codesigning identities (i.e. certificate and private key pairs) matching were found

Code Sign error: Multiple matching codesigning identities found: Multiple codesigning identities (i.e. certificate and private key pairs) matching “iPhone Developer: Coders (4B4R89J5KK43GU33E64I4347VZ)” were found
CodeSign error: code signing is required for product type 'Unit Test Bundle' in SDK 'iOS 8.0'
I am unable to test the app on the device.
I also imported the .developerprofile file from my teammate, and was able to upload the app to app store, but cannot test app on device.
In keychain all the certificates are valid.
I tried to deleting iOS Provisioning Profiles.
I also refreshed my setting using these steps
In Xcode Preferences
> In Accounts click on your Apple ID
> Click View Details
> Click on your projects Provisioning Profile
> Click refresh button bottom left
Clean and build again, but still facing the same issue not running on device.
Make sure you don't have duplicate Certificates in Keychain Access in your Mac.
To check this open Keychain Access and within "My Certificates" check that you don't have duplicate certificates, if this is your case, remove the duplicates.
In my case, the solution was the automatic "iOS Developer" option (With Xcode 6.2)
And on the second "Build Settings":
I ran into this problem a few months ago and just ran into it again just now. Last time I fixed it by refreshing my account under Preferences. It did not work this time even after removing/adding all the accounts and clear all xcode related keychain items.
Finally I changed the Provisioning Profile from "Automatic" to a specific Profile which worked.

Valid provisioning profile not found but has matches

I just added a new device to the provisioning portal, generated certificate, mobileprovision, etc. My keychain has the certificate in it, my device has the app's profile on it, and there's a green checkmark underneath Status. In the build status tab of the project underneath Code Signing Identity both Debug and Release say "currently matches [my information]". However, when I try to run the app on my phone I get "A valid provisioning profile for this executable was not found."
Extra information that may or may not be relevant: The app was running in the simulator but when I tried to build it for the iPhone I got the Mach-O linker problem with armv7 architecture because I hadn't linked the necessary frameworks. So I created a new target and added the appropriate files. This target does say that my Code Signing Identity matches, and it's where I got the bundle identifier to generate the provisioning.
I have tried cleaning and building again.
Possible solutions:
Sometimes there may be two different provisioning profiles with same names in Xcode for different AppIDs. Windows/Organizer(Shift+Cmd+2)/Library/Provisioning Profiles/. Check if you use the correct one.
In Apple Developer Portal and Organizer check, if your provisioning profile is not expired.
Check, if the provisioning profile has proper AppID or WildCard AppID. Check if it matches to the Bundle ID in Info-Plist of your project. Check also Device IDs.
Did you use the same Mac before? The certificate, that is used in Provisioning Profile creation is bound to the Mac. Try to completely recreate it on your Mac or get a key file from other Mac for that certificate.
I ended up deleting all of the provisioning profiles and certificates on my computer, invalidating my cert on apple, and then requesting and creating a new one. Now everything works.

Code sign error in iOS app

I got an ios app, whe i trying to build it on device, XCode shows me this error:
Code Sign error: The identity 'iPhone Developer' doesn't match any valid, non-expired certificate/private key pair in the default keychain
Any ideas? What is the reason?
Except for the provisioning profile, you need also the private key/certificate exported from the keychain of the creator of the provisioning profile.
Look here
You will have to buy a development certificate in order to run your developments on your device.
Of course you can use the simulator free of charge.
To get a valid certificate - you need the user that issued the development certificate for this app to export the certificate files physically from his Mac. This means opening Keychain Access, right clicking the certificate and selecting "Export...". Then when you get this certificate, just open it and it will be added to your chain.
I just delete all profiles from Key-chain. And the create new profiles in developer.apple.com

Cant archive ios app

I tried to archive app for ios devise. But archivation failed.
Xcode show me: Code Sign error: The identity 'iPhone Developer' doesn't match any valid, non-expired certificate/private key pair in the default keychain
What happened? How to archive app for testing app on ios devise?
This is one of XCode's rare error messages that is actually descriptive and precise. You can break the message down a bit and make a little more sense of it.
The identity 'iPhone Developer' ...
This suggests that you are trying to use your developer profile to make an archive when you should be using your distribution certificate and provisioning profile.
Have a look at this page. (Apple login is required) if you don't have a distribution profile.
... doesn't match any valid, non-expired certificate/private key pair in the default keychain.
Even if you are using your distribution certificate (I don't think this is the case based on the first part of the message but if you are sure it is your distribution certificate and it's just badly named, please continue). Go to Keychain Access and check that your iPhone distribution certificates (and any other relevant certificates) haven't expired.
If it's neither of these, go to Organizer and check that your provisioning profiles haven't expired either.

Resources