Can't run Xcode project on device due to certificate issues - ios

This is the first question I've ever posted.
I am trying to run an Xcode 9.0.1 project on an iPhone 6 Plus and these three errors come up:
Code Signing Error: The user name or passphrase you entered is not
correct.
Code Signing Error: No signing certificate "iOS Development" found:
No "iOS Development" signing certificate matching team ID
"KP3X78QM3M" with a private key was found.
Code Signing Error: Code signing is required for product type
'Application' in SDK 'iOS 11.0'
I suspect this is caused by Xcode not being able to read the developer certificates on my computer. This is what the General tab looks like under Signing. Clicking "Try Again" will generate a new certificate but all of the errors still remain.
I checked the Keychain Access application and it has an iPhone developer certificate, although I'm not sure if anything else is missing.
I've looked up similar questions and started reading Apple's Xcode troubleshooting guide but I am still confused and don't want to accidentally modify anything important.
I desperately need to fix this issue; if there is an Apple support email or someone I can contact in person about this, that would be amazing.
Thanks in advance!

I found a solution!
Even though this question only has a few views, I'll share it in case anyone else has the same problem in the future.
Long story short, I Quit Xcode while the two errors were still present in the Signing section of the General tab. At this point, clicking Preferences -> Accounts -> Manage Certificates still gave the "Missing Private Key" error messages like so.
After quitting Xcode I restarted the computer and opened Xcode again. Under the Signing section for the General tab, it prompted me to log in with my Apple ID. After logging in, the two errors were gone. I opened the "Keychain Access" application on the mac, clicked on the "My Certificates" tab and noticed that a new certificate had been generated WITH a drop down arrow that contained a new private key!
To set up the new key so it works, connect your device (in my case an iPhone 6 plus) to your mac and run your Xcode project on the device. A window titled 'codesign wants access key "access" in your keychain." should pop up, wanting the password for your computer.
VERY IMPORTANT: Type your computer login password (not your Apple ID password) and click ALWAYS ALLOW! I got confused and accidentally hit "Deny" the first time around which is what got me into this mess in the first place. Click "ALWAYS ALLOW"!!!
After this point, Xcode should be able to run your app on a device.
Good luck!

Related

How can I fix a revoked certificate?

I seem to be caught in the 9th circle of certificate/profile/signing hell. I get this notice from apple when attempting to test a little learner app on my iPhone:
The following certificate has either been revoked by a member of your development team or has expired:
Certificate: iOS Development
Here are the conditions:
MBP running 10.13.4
Iphone 6+ with iOS 12.4.1
Xcode 9.4
More info:
I formerly had an Apple Developer Program paid membership which expired in 2017. I did not renew it, because I'm just learning and have nothing to distribute. I started trying to learn Swift, and for a while had no trouble testing my apps on my iPhone. Then an injury interrupted my efforts for around a year. Now, my attempts (using Ray Wenderlich's excellent site) to build and run my project on the iPhone go nowhere, and I get this:
Code Signing Error: The user name or passphrase you entered is not correct.
Code Signing Error: No profiles for 'com.radianimagery.HitList' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'com.radianimagery.HitList'.
Code Signing Error: Code signing is required for product type 'Application' in SDK 'iOS 11.4'
Here's what I see in the "Signing" section of the app:
I've tried the developer website, looked through questions on SO (most pretty old), and I'm just plain stuck. I downloaded all my certificates, then hit "Manage Certificates." I get this window, indicating that all my thrashing this morning created more certificates, but I can't seem to do anything with them:
I admit upfront that this whole certificate/profile side of things has always mystified me. That having been said, can anyone please help me get back on track?
TIA
EDIT
I finally had to create a new user account on my MBP, then a new Apple ID. then I joined under that Apple ID, and everything has been peachy since.
Many thanks to all who responded!
It sounds like your Apple ID password may have changed since you last used Xcode - that would explain your Code Signing Error: The user name or passphrase you entered is not correct error. Try navigating to Xcode > Preferences... and view the Accounts tab, and check for any errors there. Xcode may prompt you to sign in again with your Apple ID.

"Your account already has a valid iOS Development certificate" error

Xcode always says "No code signing identities found" when I work on a new project.
Normally, I just press fix issue, and it works. But since a while, it keeps saying "Your account already has a valid iOS Development certificate". When I try to press "Reset" in Xcode 7.2, nothing happens, other than that I get a email that my certificate was revoked. I still get the same error. I also tried the Xcode beta, when I press "Reset" there, it says "Certificate installation failed".
I'm a free(not paid) apple developer, so I don't have access to the member center. I also haven't got a mac that has got the old certificate, otherwise I could just import it from there.
Recently WWDR certificate expired(actually on 14/02.2016) and this caused a lot of issues. You could try downloading the new one:
https://developer.apple.com/certificationauthority/AppleWWDRCA.cer
This is not a part of the development program and you don't need access to member center in order to download it.
Keep in mind to remove the old one from Keychain access in both Login and System(you may need to check View->Show expired certificates if it doesn't appear).

iTunes Store operation failed. You are not authorized to use this service for provider

I am using Xcode 7.2 and I am not able to submit my app due to a strange error: "iTunes Store operation failed". I've reset my certificates, reset my provisioning profiles, cleared out my keychain, and still no success. I've also gone to "Xcode -> Preferences -> Accounts" and deleted my account, and re-added my account. I then went into "View Details" and clicked "Download All". I've done research which all tell me to do the steps above, but I tried all these steps countless of times and I cannot seem to figure this out.
Any ideas?
Go to member center -> Choose iOS Provisioning Profiles (Distribution) -> edit - > add file "keychain access CertificateSigningRequest.certSigningRequest " from your device -->download provisioning profile certificate and add it to keychain access --> Quit Xcode and reopen hope it will work
Did you try unchecking the Include bitcode option before sending your app to Apple? I have been getting the same error quite frequently and what I notice is that it could do something with internet connectivity. When I submit my app from office with high speed connection, there is no problem at all. But from home where I have lot lower speed, I have to uncheck Include bitcode to successfully submit my app.
The only way I was able to upload my project to the app store was to use the Application Loader built into Xcode. I believe that this is a new bug with Xcode 7.2. Here is a detailed walkthrough of using Application Loader:

Xcode fails to build on iPad, gives code-signing error

I've been researching this for a few days now and haven't been able to find a solution.
Backstory: I'm picking up a project that a previous worker left behind. I'm using a different Macbook to work on the project than was originally used, and I think that's an important part to my problem.
Problem: I've gotten the emulator to compile the program just fine, but when I try to install to a physical iPad, Xcode gives me a drop-down error that says
"Failed to code sign 'app-name'. No valid signing identities matching
the teamID 'id-value' were found. [Cancel] [Fix Issue] "
When I click [Fix Issue], I get this message:
"Could not generate key pair for CSR. [Cancel] [Done]".
When I Go to Xcode->Preferences->Accounts->ID->Signing Identities->iOS Development->Create, I get the same error: "Could not generate key pair for CSR. [OK]"
I found this StackOVerflow response, and copied and ran their script and found two errors in my .proj file. I hoped it would fix the problem but it did not.
Go to XCode->Preferences->Accounts
In the left bottom click on plus button and then "Add Apple ID", add your developer account credentials and click Sign In. Xcode will show all your teams, double click with which one you want to debug. In opened popup look at into Signing Identities tab->IOS Development, click create button under Action tab. Xcode will create new certificate for your mac. Add this team as a team for your project, then in your project's build settings set "Automatic" for Provisioning profile->Debug and "IOS Developer" for Code Signing Identity->Debug and you should be able to run app on device.

Xcode 7.1 "iTunes store operation failed you are not authorized to use this service"

Trying to submit iOS and Apple Watch OS2 extension update from ios 9.0 to 9.1. I recently updated Xcode to version 7.1 and now I'm hitting this problem without changing anything else.
iTunes store operation failed you are not authorized to use this service
What I've tried:
Removed developer account from Xcode -> added developer account back into Xcode -> Still hit the error.
I tried Xcode -> Preferences -> Apple ID -> Download All to get my latest provisioning profiles up to date. Still get the error.
Deleted all old archives, cleaned project, archive again. Still get the error.
Increased build number and version number in both the project and in itunes connect. Still get the error.
Deleted derived data in the Library -> Developer folder and I still get the error.
Cleaned the project -> Archived the project again -> Unchecked "enable bitcode" and I still receive the error.
Code Signing Settings:
Watch Target -> Provisioning profile automatic code signing iOS Developer
Watch Target Extension -> Provisioning profile automatic code signing iOS Developer
iOS Target -> Provisioning profile automatic code signing iOS Developer
Still hit the error message with the provisioning profile settings.
Reinstalled Xcode 7.1 -> Still hit the error message.
I've also confirmed that all my developer and distribution provisioning profiles are valid and downloaded.
Observations:
One thing I've noticed is that when I archive the app and look in the Window -> Organizer I notice my iOS apps on the left side for my archives. This app I'm trying to submit has no name next to it. However, if I delete all old archives for this app the app name shows up again next to the app icon. Maybe a bug with Xcode but I have no clue.
Another thing I've noticed is I've been able to successfully submit iOS archives that have no WatchKit extension using Xcode 7.1. I'm not sure if the WatchKit extension could be the problem but it is a possibility.
Also when the archive is ready to be uploaded to iTunes Connect I notice a couple of things. First, the iOS App defaults to the active provisioning profile: "MyApp" Distribution profile. However, both the WatchKit app and app extensions automatically default to the XC* wildcard provisioning profile. I'm not sure if this whole problem could just be related to a provisioning profile error but it is possible.
iOS Target -> Build Phases -> Embed Watch Content is set as:
$(CONTENTS_FOLDER_PATH)/Watch
Application Loader Submission Attempt:
Tried and failed with the following error message:
ERROR ITMS-90171 "Invalid Bundle Structure - The Binary file 'MyApp.app/Watch/MyAppWatch.app/_WatchKitStub/WK' is not permitted. Your app can't contain stand alone executables or libraries other then the CFBundleExecutable of supported bundles. Refer to the Bundle Programming Guide..."
Again, I used this exact same project structure to submit the ios app and watchkit OS2 extension on Xcode 7.0 ios 9.0.x no problem. I think the error message is inaccurate unless I'm misconfiguring something but I imagine I would've hit the error back on Xcode 7.0
Any help on how to solve this would be awesome. I've found no help googling and reading other SO posts and I've been stuck on this for far too long. Thanks!
I met the same issue today and I think it is a bug of Xcode 7.1
Finally I managed to submit my app via Application Loader. There were warnings but it did work.
Here are the basic steps:
Archive
Export
Xcode menu --> Xcode --> Open Developer Tool --> Application Loader
Double click "Deliver Your App" and choose the file exported in step #2
click next and follow the instructions until the end
I found the solution by unchecking the Include bitcode option.
In mi case, it seems that updating to Xcode 7.1 removed some account information. So, after a few attempts to upload it from Xcode, I opened Application Loader, and it asked me to login. I logged in and finally could submit to the App Store from the Organizer. Hope it helps someone.
it is the enable bitcode on the bottom when you submit the upload. uncheck the box. for some reason it comes with 2 boxes checked by default on xcode 7.1
Set team in target-> General-> Team
Check and set appropriate provisioning profile in targets/project build settings.
Try with Xcode to upload build if find same issue.
Or
Try with application loader it will work.
In my case I think it should be a xcode 7.1 bug. I re-added my account, re-generated profile, rebuild the app (restart my mac) but none of them work! I got this error when I first validated the app.
Then I created a new profile and the validation passed. But the first time uploading the app xcode still showed that error. Unwilling to give up I clicked the upload button again and this time it succeeded!
I faced the same issue then I uploaded through Application Loader from XCODE menu and it showed so many error like missing icon for iPad etc .
So please try you app to load through Application Loader and see complete detail of errors you might have in your application.
I got it working through Application Loader after fixing these issues.
I am using Xcode 7.1.1. and it appears to be an issue with Xcode, because I successfully submitted the build via Application Loader. Now, I suspect that I added too many SDKs / adapters inside the code that may have caused issues with the app's delivery. But there's no way of knowing that for sure.
During upload my API Analysis to the App Store was skipped, because it was too large, but I doubt that may caused Xcode to upload the app to the App Store.
If Xcode fails to upload, try Application Loader.
Solved for Xcode 7.2 by revoking and recreating the cert:
Image of what to click here (sorry no embed reputation)
In XCode go into this menu:
XCode -> Preferences -> Accounts
When on the accounts tab, I selected my email in the Apple Id list (on the left).
Then on the right there is a list of of teams under Team Name, select the correct Team and click on View Details.
Finally, there's a list of Signing Identities, next to "iOS Distribution" click Reset.
I didn't have to restart XCode, I just immediately resubmitted to iTunes from Organizer with no problems.
Edit: Thanks #Dover8 for the info about possible effects.
https://developer.apple.com/library/mac/documentation/IDEs/Conceptual/AppDistributionGuide/MaintainingCertificates/MaintainingCertificates.html
Resetting Certificates Using Xcode
If Xcode detects an issue with a signing identity, it displays an
appropriate action in Accounts preferences. If Xcode displays a Create
button, the signing identity doesn’t exist in Member Center or on your
Mac. If Xcode displays a Reset button, the signing identity is not
usable on your Mac—for example, it is missing the private key. If you
click the Reset button, Xcode revokes and re-creates the corresponding
certificate.
Try to check your iOS Provisioning Profiles on
https://developer.apple.com/account/ios/profile/profileList.action
In my case one of profiles was marked as "Invalid" and after profile regeneration an error no longer appears
I got the same problem.
Tried to Upload To App Store.. 3-4 times.
Then I Hit the Validate... button and validation was success.
After that tried to upload again and it succeeded.
Then i cursed apple...
It seems to be related to the latest iTunesConnect update and "roles".
If I look at the "iTunesConnect Users" screen, we have three accounts,
(1) is "Admin, Legal", (2) is "Technical, Marketer", and (3) is "Technical Only".
Now when you click the email address to check the details and "roles" of #2 then only "Marketer" is checked, and only the marketer permissions are available.
For #3 the correct checkmark ( Technical ) is set, and also "Create Apps and Submit versions" is shown as an available "App feature".
It might be a work-around to change permissions to disable and re-enable "technical", or maybe give more permissions and make the person an Admin (temporary, of course).
Also - for the Jenkins users out there, you might have copied some certificates from the "login" keychain to the "system" keychain. Try removing them from the system-keychain ( I think that was this step which made my "Archive" not end up in 'not authorized ...' message and actually pass the verify again).

Resources