Xcode asking username & password every time I compile to device - ios

I use an admin account for the development. But every time I compile to a device Xcode is asking for admin username & password. I googled the issue. But none of the solutions worked. I tried the workarounds from this post, but it didn't work
Authorize a non-admin developer in Xcode / Mac OS
I also tried disabling and enabling the DevSecurityTools but it didn't work. I am using Xcode 4.3.1 installed on Mac OSX Lion 10.7.3.
Is there any way to fix this?

For solution go to Keychain Access,
and in the top left navigation, move your Developer certificate from "System" to "Login".
Actually problem is Developer certificate is under "System", and it is locked every-time, so it will require a password to unlock, whereas when certificate is in "Login" section it will resolve that.

In keychain remove your development and distribution certificates from System and place them under Login. It will ask once and you have to select Always allow
That worked for me. Hope it works for you aswel.

In Xcode 7.1, I didn't find Login so I have given access to Xcode and codesign for the certificate key by following steps:
Open Key Chain
Go to Certificate under System
Click on closure, right click on private key and select 'Get Info'
Click on 'Access Control' tab
Add Xcode and coding under 'Always allow access by these applications:'
It solves my problem.

Is the /Developers directory from the old Xcode still on the drive? I just had a user with this issue that was also experiencing build fails with code that other users were able to build successfully. Some of the file associations cause the new Xcode (moved to the /Applications folder) to reference components in the old /Developers folder. Once we removed the folder and emptied the trash, everything worked as expected.

After moving Developers certificate form "System" to "Login". If it still asks for Username and password, you need to check your code signing. Go to the Build Setting and under code signing select the respected developer's certificate. It works for me.

On macOS Catalina, you have to:
Open Keychain Access.
Find your developer cert under the System category on the left.
Right or Double click the cert to open the Get Info window.
Expend the Trust dropdown above the cert details.
Open the drop down menu options for Code Signing.
Set the value to Always Trust.
It may be a good idea to quit and restart xCode after this if it was open, but when I changed mine I didn't bother and it still worked as expected.

Related

(0xE8008018): The identity used to sign the executable is no longer valid

I'm trying to debug my app on Xcode and I'm having the following error:
The identity used to sign the executable is no longer valid.
Please verify that your device’s clock is properly set, and that your signing certificate is not expired.
(0xE8008018).
Now I know there are many questions regarding this issue, and I have tried every possible way to solve it, what I have tried so far (didn't work):
Some suggested to restart Xcode.
Refreshing the account.
Deleting all the certificates from the keychain.
Revoking all the certificates from the member center.
Installing the certificates manually.
Checked my Devices clocks (obviously)
Removed Xcode (disparately) and re-installed it.
Checking my project Build config, and made sure that the developer account is selected.
Checked my account expiration date (it's renewed 5 days ago)
Checked if I have to accept some Conditions and Terms (none)
Disabled the devices I have in the Member profile
Tested on multiple iPhones (same result)
Checked out a git tag/branch which is stable (I thought the project might be corrupted also disparately)
My concern is that it might be a temporary issue from apple, or a bug in Xcode, although it was working hours ago on my iMac, when I switched to the MacBook Pro I had this issue (and I always do this with no problems at all).
Running:
OSX Yosemite 10.10.4 (14E46)
Xcode 6.4
Trying to remove and re-add your apple id, it works for me.
xcode: Preferences...
Accounts
Select your apple account
Remove that (-)
Add again your apple account (+)
Run yor app!
After hours of investigating, the shell script for signing the project was failing at some point, without reporting back to Xcode.
I noticed that in the DerivedData folder (found in /Users/yourUsername/Library/Developer/Xcode/DerivedData/) of Xcode there were two folders with the same name of my project ending with a different hash, for example:
ProjectName--dcakkvkdhqvxstehdiuzwbpsmdal
ProjectName--kurbctkdhqvxuytrwnczwbpsmdal
I closed Xcode, and made sure to delete both folders, somehow Xcode generated two different folders for the project at some point, restarting Xcode after the deletion of the folders fixed this.
I have experienced the same situation.
But it was cleared by deleting and downloading again the provisioning profiles on my mac.
The location of the provisioning profiles is:
/Users/yourUsername/Library/MobileDevice/Provisioning Profiles/
I had the same issue. What helped me:
Set Profile to a wrong one (other project)
Run project and received the popup with information that provision profile is wrong and proposal to Fix the issue
Press Fix the issue
Just login to your developer account and create new developer certificate or revoke older one an create new. It will resolve the issue.
A Solution that might help some People
Go to developer.apple.com
go to the identities/certificates page
then click on Provisioning Profiles If you found few invalid
profiles just edit them
Make sure you check your main profile.
Click generate and close.
Now in XCode, remove your profile Add it again.
You're good to go
This will happen if you changed your Primary Email
Delete files and folders from:
~/Library/MobileDevice/Provisioning Profiles/
~/Library/Developer/Xcode/DerivedData/
The only solution for this problem is to delete the folder from
~/Library/Developer/Xcode/DerivedData/YourAppName-
This way everything will get back to normal !
Cheers !
All of the answers helped a lot but in my case developer certificate got expired that's i was getting this error while building the app.
Keychain -> Login -> My Certificates
So just removed the certificate and created new one worked fine for me.
NONE of this worked for me
vomako 's answer at The identity used to sign the executable is no longer valid
DID work -
i.e.
"Solution within Xcode:
In Xcode, go to Preferences --> Accounts --> View Details
Press the refresh button in the lower left corner (called Download all in Xcode 7)"
end of his post
It's a little refresh symbol now (circling arrow)
Then click on the Request button
Hope this saves somebody some time
I have solved the same problem. Just from "https://developer.apple.com/account/ios/profile/production/create" re-created the new Provisioning Profiles. Then download and install the new Provisioning Profiles of (Development and Distribution).

command/usr/bin/codesign failed with exit code 1- code sign error

I'm currently in the process of submitting my first app to the Apple store.
I've completed the following processes
Obtained a developer account
Logged into the Member Center to Create an App ID
Used keychain access to request and receive a distribution certificate
Obtained a provisioning profile using my id and certificate
When I build the app it runs perfectly in the app simulator and on the actual ipad, however when I switch my app to Archive on iOS Device i have a major code sign error which i've attached below.
codesign /Users/Gaby/Library/Developer/Xcode/DerivedData/RoyalAppInspection-dthvtpxadkslqmhkwdpaqkyujscg/Build/Products/Debug-iphoneos/RoyalAppInspection.app
cd /Users/Gaby/Desktop/RoyalAppInspection
export CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin
/usr/bin/codesign --force --sign 79640A11C8D22589BD337496ABB8443581513846 --entitlements /Users/Gaby/Library/Developer/Xcode/DerivedData/RoyalAppInspection-dthvtpxadkslqmhkwdpaqkyujscg/Build/Intermediates/RoyalAppInspection.build/Debug-iphoneos/RoyalAppInspection.build/RoyalAppInspection.app.xcent /Users/Gaby/Library/Developer/Xcode/DerivedData/RoyalAppInspection-dthvtpxadkslqmhkwdpaqkyujscg/Build/Products/Debug-iphoneos/RoyalAppInspection.app
79640A11C8D22589BD337496ABB8443581513846: no identity found Command /usr/bin/codesign failed with exit code 1
I have no idea what to do to fix this, as I've tried to make sure all the other aspects of the process were completed correctly.
One concern i did have was when i clicked the provisioning profile file it would not open and "add to library" wouldn't pop up (i cannot access iphone configuration utility for some reason.) I manually added the .mobileprovision file to my xcode project but i'm thinking this may also be a source of my error.
Anyone, can you please help?
The following steps solved the problem for me. I was having the issue where it was not compiling for the device or archiving, working fine for simulator.
Open keychain access.
Lock the 'login' keychain.
Unlock it.
Clean and build after doing the above steps and everything works fine now.
You almost made it on your own, but in the end there seems to be something wrong with your profile.
First I would recommend a tool to "look inside" the profile to make sure it's the right one: http://furbo.org/2013/11/02/a-quick-look-plug-in-for-provisioning/
This will just add some more information about the profile, when selecting it in Finder and pressing space (Quick Look).
Check your Xcode Preferences:
Xcode Perferences (CMD + ,)
Accounts
Select your account on the left
Select view details on the bottom right
Refresh (using the small button on the bottom left)
Xcode stores the profiles in ~/Library/MobileDevice/Provisioning Profiles
If your distribution profile is not in there, double click on it.
Then it should appear in that folder, but with a hashed name, e.g. 1edf8f42-fd1c-48a9-8938-754cdf6f7f41.mobileprovision at this point the Quick Look plugin comes in handy :-)
Next, check your Project Settings:
select the target (not project) you want to build in Xcode
switch to build settings
look for the "Code Signing" section
check if the correct profile is selected under "Provisioning Profile" => "Release"
Next, check your Scheme Settings:
select Product menu
open scheme submenu
select edit scheme...
select "Archive" on the left
Build configuration should be set to "Release"
Next, check the Keychain Access Trust settings:
open keychain access (spotlight => keychain)
select login
click on Certificates
look for iPhone Distribution: Elena Carrasco (8HE2MJLM25) on the right
right click, select "Get Info"
open "Trust" section
set to "Use System Defaults"
repeat steps 5 to 7 for Apple Worldwide Developer Relations Certificate Authority
Next, check the Keychain Access private key Access Control:
repeat steps 1 to 4 from previous check
expand the profile to make your private key visible
right click on the private key, select "Get Info"
switch to "Access Control"
select "Confirm before allowing access"
use the "+" button to add "codesign" (normally located in /usr/bin/codesign)
Hint: if it doesn't show up in the file browser, use cmd + shift + g to enter the path manually
when using Carthage: add /usr/bin/productbuild here as well (thx to DesignatedNerd)
"Save Changes"
Hope one of this does trick for you!
Update (4/22/16):
I just found a very nice explanation about the whole code sign process (it's really worth reading):
https://www.objc.io/issues/17-security/inside-code-signing/
For me following steps worked:
Quit Xcode.
Open Terminal.
Typed Command xattr -rc /Users/manabkumarmal/Desktop/Projects/MyProjectHome
Open Xcode.
Cleaned.
Now worked and No Error.
This worked for me. Give it a try:
cd ~/Library/Developer/Xcode/DerivedData
xattr -rc .
I had this error in Xcode 8 and Mac OS Sierra. Tried all the above solutions and none worked. This was the only one that worked for me. Open terminal, and type this in:
cd ~/Library/Developer/Xcode/DerivedData
xattr -c *
For me "Restarting Mac System" got worked
For me, i just cleaned the app and it worked (cmd + shift + k), removing the error. I got the error after updating to swift 2.3.
Another reason you may see this error that I haven't seen posted yet, especially if you are using Jenkins, is that your certificate's private key needs "Allow all applications to access this item" selected.
Open your Mac keychain
Go to "Certificates" or "My Certificates" under "Category" on the left.
Find the cert you're trying to sign with, and click the little grey triangle on the left of the certificate to reveal the associated private key.
Left/ double-click the private key and select "Get Info."
Toggle from "Attributes" to "Access control"
Select "Allow all applications to access this item" and save changes.
I maintain a large cluster of Mac mini nodes as part of a centralized Jenkins CI system, and this can come up.
Do everything d4Rk suggests, that is a great walk-through.
if it still isn't signing, you might have some expired or revoked certificates. I find this can happen when you're working on a team.
quit xcode.
open Keychain Access.
in the 'Certificates' section, go through all "iPhone Distribution" certificates and if they're expired or revoked or otherwise invalid, delete them.
same as 3, but for the 'My Certificates' section.
re-open xcode and try again.
I Followed all the things mentioned in this thread but still facing same issue-
/usr/bin/codesign --force --sign A7F8FCD694D7923A3E57826398C3380E2E5A5446 --entitlements unknown error -1=ffffffffffffffff
Command /usr/bin/codesign failed with exit code 1
I have configured Automatic signing with my code base which will work with xcode run as well as xcodebuild run from terminal from my machine but it gives above error when I run it on jenkins pipeline or try to run on terminal from remotely connected machine
In my case Automatic signing is not working if access remotely. because I need to open keychain before archive using
security unlock-keychain -p "newpassword" "/Users/xyz/Library/Keychains/login.keychain"
keychain passwords & login password for macOS X user was different I change it to new same password and it works for me.
I have solved this problem, very easily.
Just reboot the computer ( it refreshes everything by itself ).
I hope this helps..
Open the project into the Xcode.
Select project.app file and right click on it, select “show in finder” option.
Open terminal and go to the project.app file path.
Type the following to commands one by one:
xattr -lr project.app
xattr -cr project.app
Open the project and run.
Reboot also worked for me. Interestingly it seems to be an issue with allowing Xcode access to the certificates. When i tried the archive again, i received 2 popups asking me if i wanted to allow Xcode to access my keychain. After this it worked fine.
Just reset your development and distribution certificate and clean your project.
After that ,
Reboot also worked for me. Interestingly it seems to be an issue with allowing Xcode access to the certificates. When i tried the archive again, i received 2 popups asking me if i wanted to allow Xcode to access my keychain. After this it worked fine.
Remove the existing precompiled files:
rm -rf /Users/raghu/Library/Developer/Xcode/DerivedData/Solitare-fdaukpanamlzllacxvdzfbeqcrsg/
And try to build it again.
Rebooting didn't work for me.
Just try with downloading and adding the Certificate again to keyChain. That worked for me. When I checked Keychain Access the respective certificate was missing. Got the problem solve when I reinstalled the certificate.
delete your certificate in your dev then Reinstall and it will working!
If nothing is working in #d4Rk solution Just use the below screen to delete unwanted/expired similar provision profiles. Right click on provision profile to move it to trash.
provision profile window
Because in my case after doing all the steps I was still getting the same issue and it resolved when I deleted old expired provision profiles with same name and then using the correct one in build setting.
In my situation, some pods were out of date after I updated my OS. Here's what fixed it:
In terminal:
cd /Users/quaisafzali/Desktop/AppFolder/Application/
pod install
Then, open your project in Xcode and Clean it (Cmd+Shift+K), then Build/Run.
This worked for me, hope it helps some of you!
I had the same error on January 2018 with xcode 8.2.1
Before I try to open xcode I couldn't because the system was updating. I tried sometime later and it let me working on it, and then I got the same error.
I followed most of the solutions described in this article but they didn't work for me.
Then I remembered the message about the system updating and I tried to reboot the machine.
And that did the magic. It worked for me.
Rebooting worked for me too. After upgrading to High Sierra I got tons of problems with password and it looks like I needed to enter the Password for the Keychain access to XCode.
I recently had this issue and all above solutions didn't work for me.
The reason why it works on your simulator but not real devices is probably related to your Development Certificate.
So I revoked my certificate on Apple Developer Portal and request a new one on my computer. Here are the steps:
Goto Apple Developer Portal and revoke your old (not working) development certificate.
Add iOS App Development Certificate
Follow the step on from Apple
Download the newly generated certificate and add it (double click) to your Keychain
Make sure it is in your XCode Accounts
Then it works!
Hope it helps!
I have Solved This Problem. If your project has .xcdatamodeld file (mean you are using coreData) then make sure the entities you formed go its Data Model Inspector and check Class has codegen, manual/None or classdefination. if it is class defination then make it manual/None and clean the project and run again. screenshots are given below:
I was having the issue after select the deny when it asks for permission
After some search I got it fixed by restarting the system.
Today, 2020 year, I've solved this problem with Xcode 11.7, Xcode 12.0 and Xcode 12.1 following these steps:
Identifying the bad certificate:
From you Keychains select Login
From Category select Certificates
Find any Apple Certificate that has the blue +
Double click on the certificate.
Expand the Trust
If it's messed up then the "When using this certificate" is set to "Always Trust" along with the blue +
Fixing the bad certificate:
Just set it to "Use System Defaults" and close it.
You'll get a pop up. Type in your password to update settings.
Close KeyChain.
Go back to your project, clean and run.
Problem should have gone away.
If that didn't work then go back to Keychain and just double check and see if there are any other Apple certificates that are set to Always Trust and repeat the process.
The easy way (which will do all png files) I used:
Run This Command in Terminal
find . -name "*.png" -exec xattr -c {} \;

Can't validate iOS app (getting already has valid certificate)

When switching to Yosemite I did a clean install of my Mac and now I'm having issues submitting my iOS to the store.
When I validate my archive I keep getting "Your account already has a valid iOS Distribution certificate".
I have tried renaming and redownloading my certificate from the member center but that didn't work.
A very common "doh!" is you copied over the relevant item in Keychain,
BUT!
you forgot the private key part:
So fi the disclosure triangle on the left is missing and the "key" symbol part is missing, that's what's happened.
Solution: just EXPAND the triangle and highlight BOTH parts, then click export. move the file to your other Mac and open.
ALSO -- don't forget, in Xcode you have to literally login these days.
Xcode - Preferences - second tab == Accounts
It's easy to forget, say, one of your various client's accounts there.
The App Distribution Guide on the Apple Dev site states that this can be a frequent problem if moving from one mac to another (or re-installing in this case). A simple fix would be to export your certificates as a developer profile file from your previous install, but you probably don't have a back up readily available. Try clicking the 'revoke and request' button and see if you can re-download your developer profile file.
Hope this helps,
Will

The identity used to sign the executable is no longer valid

I have an application that I am debugging on iPad.
2 days ago I wanted to debug a same updated application but I am having this error.
The identity used to sign the executable is no longer valid.
Please verify that your device’s clock is properly set, and that your
signing certificate is not expired.
(0xE8008018).
I don't have iPhone Developer certificate yet, but I have debugged this game once.
Neither restarting Xcode nor restarting my Mac helped.
Solution within Xcode:
In Xcode, go to Preferences --> Accounts --> View Details
Press the + symbol and select iOS Development
Press the refresh button in the lower left corner (called Download all in Xcode 7)
PS:
Sometimes it may also help to delete invalid provisioning profiles: right-click -> move to trash
I saw this error exactly one year after signing up as an Apple developer.
Try restarting XCode. It worked for me.
This may happen when your certificate expire in your Key Chain.
EDIT : I'd now recommand cert and sigh to generate your certificates and provisionning profiles. These are two commands part of the fastlane tools from KrauseFx.
Using cert & sigh:
Open a terminal and type cert
Answer the prompted questions to sect your user, password, team, app, etc.
Open a terminal and type sigh
Answer the prompted questions to sect your user, password, team, app, etc.
Select the right profile in Code Signing Identity (iPhone Developer)
Conventional way:
Just go to the new provisioning portal : Certificates, Identifier, Profiles
Login with your developer account.
Go to Certificates and click the Plus button.
Then select iOS Apps Development and click Continue.
Follow the whole process and download the newly generated certificate.
Download it and put it in your keychain.
Update your profiles from XCode Organizer devices window
Select the right profile in Code Signing Identity (iPhone Developer)
If all the above previous suggestions fail after renewing your certificate, as they did for me, browse to the following location;
~/Library/MobileDevice/Provisioning Profiles
...and delete your provisioning profiles.
Then download your provisioning profile again from;
https://developer.apple.com/account/ios/profile/profileList.action
If you are using jailcoder, make sure you jailbreak your iphone successfully. Don't forget install AppSync for IOS in Cydia.
In the latest update from xcode this problem usually occurs when your certificate has expired and xcode continues to use the old one until it has expired.
Closing xcode and opening it again will fire off an automatic process of downloading your new certificate and getting your app working.
Just close xcode right down (Cmd + Q) then open it back up again, load your project and hit play .. it will ask you if you'd like assistance to auto fix the certificate problem then you just follow the onscreen instructions and it does all the hard work for you :)
You have your provisioning profiles outdated.
xcode
Preferences
Accounts
Select your apple id
View Details (Right-bottom corner)
Download All
Run again and DONE!
This may be somewhat of an empirical approach but is worthwhile in the face of many commentators noting either "this worked for me" or "this didn't work for me". Firstly, the problem can lie in a number of locations, either your certificates (code signing identities) or your provisioning profiles. Identifying where the problem lies first before doing anything will save a lot of wasted effort. You will need to check in three places:
XCode
Keychain Access
The Developer Portal (Developer Members Centre)
OK, in XCode click on the Project (Above the Targets Heading), select Build Settings and scroll to 'Code Signing'. Expand the 'CODE_SIGNING_IDENTITY' heading and you will see a bunch of identities (Debug, Release etc.) Each one of these will match up with a certificate in Keychain Access. Find the match and check the expiry date...if it has expired you will need to update it in the Developer Portal and download it. Check EVERY identity, not just the first one you find that has expired. Also, if it has expired you will need to regenerate any provisioning profile that used the expired certificate.
If no problems with the certificates, check the expiry date of all the Provisioning Profiles. Once again, if they have expired, they will need to be regenerated.
Once complete, repeat the same process for the TARGET you are trying to build for.
None of this worked? An expired certificate is lurking in one of your provisioning profiles. A sign that this might be the case is that when you click on a CODE_SIGNING_IDENTITY the identity is below Other... eg.
This is usually a sure sign that there is an expired certificate lurking about and that one of your profiles is using it.
I faced to this problem when my membership was expired and I renewed it. I use xCode6 and I solve this problem by revoking expired developer certificate from Member Center and cleaning build folder ( alt+[Product>Clean] ). xCode handle others issue itself.
See "Replacing Expired Certificates" section on this link:
https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/AppDistributionGuide/MaintainingCertificates/MaintainingCertificates.html
I had this problem with XCode 6.3 Below is the steps that worked for me.
Go to XCode > Preferences > Accounts Select your developer account then click View Details... Click on the refresh button on the left bottom of the window. It should notify you that you're missing few certificates. Click Request. XCode automatically should download missing certificates. Click Done and it should work.
you debug it on simulator only if you don't have iPhone Developer certificate. check on left corner in
xcode you select simulator not device.
I faced the same issue, I deleted all provisioning assets from xcode & added them back, and just relaunched Xcode.
My App was loaded on to the device and it worked.
This does also happen if your developer certificate is expired. Time to pay apple and renew it :P
First: go to build settings and check, if your valid Code Signing Identity is chosen.
If that doesn't help, try the more complicated stuff
In my case, this dialog message worked
The identity used to sign the executable is no longer valid.
Please verify that your device’s clock is properly set, and that your
signing certificate is not expired.
(0xE8008018).
My certificate in Keychain Access was given status to be not valid yet in red color with expiry about one year and an hour in future. I set my time to be one hour ahead and status of the certificate became valid in green color. So, anyone out here who thinks the solution to be the xcode restart is not correct but it would be cause of time elapsed of the xcode restart to make the certificate valid. As, by clicking the Fix Issue button revokes and creates new certificate with exactly one year ahead (plus some minutes depending upon locales to raise this issue).
My solution, after nothing else worked, was to go to Keychain Access and delete all "iOS developer" keys/certificates, then let Xcode regenerate them.
Try setting the time on the mobile device and the Mac to "set date and time automatically" checkbox and restart xcode, that did it for me
The Problem here is that your profile was built on an expired certificated
-so you have to go inside the developer portal and renew your certificate if it was expired
-then regenerate the profile so it will be rebulit on the new certificate
i suggest to use the iPhone configuration utility tool to manage profiles on your mac
If your certificate is not installed locally. Or you tried running the certificate and opted to "revoke and request" a new certificate then you have the option to do that on the machine you are trying to run on
go to Preferences-> Accounts-> under your AppleId -> View Details -> under signing identities you can see the status of your certificate "Valid" or "Revoked" if revoked and you want to request a new one go to the -> + then -> the type of distribution you are trying to use.
In Xcode 5.1 - there is a self help area that did the job for me.
You'll find it in the General section after clicking on your project name under > Targets.
You should see a warning icon and a description of the issue in the Identity section (right where you type in your build/version numbers).
It noticed that there was no certificate currently stored and via some self-help boxes and a change of my password, I got it going.
These were the reasons I had this error:
The App ID didn't have my iOS Developer Certificate checked (I'm a member of an Enterprise program) and I had 2 provisioning profiles with the same App ID in my Mac. I deleted one.
Hopefully this helps someone.
I tried all of the above. I kept getting the error about the UUID not being found.
I went to the project, opened project.pbxproj and found all instances of the UUID (2) and deleted the UUID (not the entire line).
Fixed the problem.
I fixed this issue by selecting the correct team within Xcode (I'm part of multiple teams). Also, I revoked my certificate, requested a new one, uploaded that, and then re-downloaded it.
Experienced the same issue. Was an issue with an expired certificate. You'll need to create a new cert and corresponding prov profile. Follow dulgan's advice for doing so.
Removed the profiles from the directory on your machine: "~/Library/MobileDevice/Provisioning Profiles". And logged to apple developer centre and edited the specific provisioning profile and selected the certificate for provisioning profile and generated the profile again. Installed the new profile and it worked for me.
Found another way this occurs today. When you edit your provisioning profile after a certificate change you can see the certificates selected says 2 of 1 certificates selected (if you just use 1 certificate). Just by unselecting and reselecting the certificate you can regenerate and install the profile and it solves the problem.
#vomako 's solution almost solved my problem but I had to take another couple of steps.
I refer to the following...
In Xcode 6.1.1, I went to Preferences --> Accounts --> View Details
After upgrading to Xcode 6.1.1, the main issue for me that the >View Details button was greyed out.
I had to delete my account, restart Xcode, then add my developer account back in.
After this step, I could yet again view details and refresh my provisioning profiles.
I selected None from Team dropdown in target general settings. Then selected the original team. Xcode shows some spinner next to it. Wait for it to complete and then everything works. Tried it in Xcode 6.2
I had this problem several times, normally it can be solved by close-reopen Xcode.
I did delete derived data from Xcode organizer. It eventually works
Today I faced this issue on my Xcode 6.3 public release.
I tried to restart Xcode several times but issue remained there.
What worked for me is
Manually create a new development profile at "http://developer.apple.com"
download and install this new profile, select this new profile from xcode build and run.

Command /usr/bin/codesign failed with exit code 1

I have the following error:
Command /usr/bin/codesign failed with exit code 1
Here is what I already did for trying to fix this:
set the bundle identifier to com.server.pgmname
set the code signing to "Any Iphone OS Device"
set the Code Signing Identity to my Distribution identity.
The error only occurs when I try to build on my device, on the simulator everything works fine.
Do you have any suggestions?
I had the exact same error, and tried everything under the sun, including what was suggested elsewhere on this page. What the problem was for me was that in Keychain Access, the actual Apple WWDR certificate was marked as "Always Trust". It needed to be "System Defaults". That goes for your Development and Distribution certificates, too. If any of them are incorrectly set to "Always Trust", that can apparently cause this problem.
So, in Keychain Access, click on the Apple Worldwide Developer Relations Certificate Authority certificate, select Get Info. Then, expand the Trust settings, and for the combo box for "When using this certificate:", choose "System Defaults".
Sigh: for those insistent on downvoting this answer, I am not claiming this to be the only solution for this problem. It's one solution. It may not work for you. There are multiple reasons for this codesign failure.
I had the exact same problem and this did the trick for me:
Xcode > Preferences > Accounts > View Details > And just refresh the Provisioning Profile
Seems like the accounts in Xcode were not updated with the latest provisioning profiles so a quick refresh sorted this out.
Feel the need to share this, even though it's ridiculous.
I'd set up a second developer account on my Mac and couldn't codesign anything. The error was "the user cancelled the operation".
A simple reboot fixed this for me.
I was fighting for about 2-3 hours to codesign a project with Parse API. It turned out that the embedded frameworks caused the problem. Make sure you set "Code sign on copy" (see picture).
If does not work delete the Parse and Bolts frameworks from the list and remove them from your project then add them again.
What worked for me was to realize that Xcode did not have access to the certificates. Please check that your certs are accessible by Xcode. Go to Keychain Access -> Certificates -> Open the Cert and double click on the private key -> Select Access Control
Just troubleshooted this same issue. I'd created a resources folder with my icons inside, then added it to my project via right-click > Add Files > [select resources folder]. Apparently this is a bad idea.
Instead create a new group in your project (called "Resources" in my case), and then right click > add files to that and then choose the individual files. Project built immediately.
For me, I just updated to Xcode 8, and converted my Swift 2.2 code to Swift 3 code, and I got errors in the Unit Testing and UI Testing. I just cleaned and then all the errors disappeared.
For anyone with this problem in the future (who doesn't want to rebuild their project), an additional question to ask is whether you have a space in your product name. I'd recommend going through your properties (right-click -> get info) of your project and your target. For my project, the only place that a space was needed was in the plist for the bundle display name.
After hours of googling and trying out different things, this is what fixed it for me:
Make sure there are no certificates in the System > Certificates tab on Keychain Access. Remove all duplicate certificates from there.
Install the WWDR intermediate certificate under certificates from the provisioning portal, in addition to the developers certificates and make sure you see it in the Login > Certificates tab on Keychain Access.
Very often the error /usr/bin/codesign failed with exit code 1 occurred in case the user has no file extensions for texture files in Models.scnassets folder. macOS very often generates a files with hidden extensions.
For example: you have a file myTexture but it must include an extension as well – myTexture.png.
I had this same problem and couldn't figure it out for a long time. I tried everything on this page and others and it still didn't work. But eventually, I did find a fix.
For this to work, make sure Xcode is not running. After you've closed Xcode, open Terminal and type in the command:
xattr -rc /[The File Directory of your project found in the File Inspector of your .xcodeproj file in Xcode]/
Obviously don't put the text in brackets, just replace it with what it says. Hit enter. Don't worry if nothing shows up below the command, it didn't for me. After that, you can close out of Terminal and open Xcode. Now everything should be fine.
Note: It might take a little longer to run your project, but just wait it out.
Also note: Don't downvote this answer because it doesn't work. This is one way to fix it that worked for me, but it might not work for you because you might have something else that is broken.
I got this error the very first time I tried to make a provisioning profile by following the Provisioning Assistant and it turns out they fail to mention the WWDR Intermediate Certificate. I installed it and it worked fine for me.
Here is my way to resolve:
Open keychain access, select your iOS certificate, Delete private key
Then go back to xCode, you will see warning warning message and "Revoke" button, click it and error resolved.
Most answers will tell you that you have a duplicate certificate. This is true for my case but the answers left out how to do it.
For me, my account expired and I have to get a new certificate and install it. Next, I looked at Keychain and removes the expired certificate but still got the error. What works for me is actually searching for "iPhone" in Keychain and removing all expired certificates. Apparently, some of it are not shown in System/Certificates or login/Certificates.
Hope this helps!
In my case, I had an extra expired distribution certificate in my keychain - I deleted the certificate from KeyChain Access and the compilation started working again.
If you're using phonegap/cordova:
I got this when building from Cordova but the solution for me was much simpler. A permissions issue.
Just set the files to correct permissions
chmod -R 774 ./projectfolder
And then set ownership
chown -R youraccname:staff ./projectfolder
Some of the answers above allude to the problem but don't clearly spell out the steps to correct it.
Here is my attempt at after it has become super frustrating which seems to have worked for me so far :
The problem is caused because there is duplicate certificates in your Apple Developer portal or potentially in your machine. I haven't had any negative consequences from doing this and its worked so far.
Close Xcode!
You have to remove the existing certs from your developer account
visit : https://developer.apple.com/account/ios/certificate/development/
and select development account ( there should be multiple certs)
I revoked each one by clicking on them and selecting revoke.
2.remove certs from your keychain on your Mac
Open Keychain app by pressing clover+space and typing in keychaing
and pressing enter
Search in the top right hand corner for "developer"
Select the potential duplicate keys and export/delete them so they aren't in the list.
Lastly regenerate your certs in XCode and rebooot
Reopen xcode
regenerate a new cert by going to project ->
General --> Signing
reselect your "Team Account"
a new cert should be generated
Reboot for good measure - and enjoy being free from this bug ( which Apple should really sort out, if it was at all possible to replicate easily)
I recently had the same issue.
Keychain Access was the culprit.
Steps:
Go -> Utilities -> Keychain Access
Keychain Access:
Edit -> Change Password for Keychain "login"
Change the password.
Close and reopen Xcode, Clean & build again.
If option - Change Password for Keychain "login" - is greyed out:
Make sure under Keychains selected -> login and the padlock icon is open.
To open the padlock you need the keychain password. If you do not know the password, go to Step 2.
With padlock unlocked and still option is greyed out.
As last resort:
Keychain Access -> Preferences
Preferences:
"Reset My Default Keychains"
Reset the login. However be careful as stored keychains will be removed and you may have re-login on other connected devices as well.
Try finding out the details of this error in the "Build Results" view where the error is shown. On the right side of the line with the error message there is an icon with several lines. This will show you some helpful details.
This way I found out for me it was a duplicate iPhone developer certificate in my keychain - one of which had been expired. Maybe search for "iphone" in your keychain (select "All Items" category first).
One solution more works with me, If you installed two versions of XCode and you install the second without uninstalling the first in the same directory (/Developer/), you did it wrong.
So the solution that works for me was:
1 - Uninstall the current Xcode version with the command sudo /Developer/Library/uninstall-devtools --mode=all.
2 - Install the first Xcode version you had first.
3 - Again sudo /Developer/Library/uninstall-devtools --mode=all.
4 - Then, all is clean and you are able to install the version you want.
More things: maybe you need to restart the computer after install the Xcode or even (in some cases) install two times the Xcode.
I hope I works it take me a lot of time to know that, good luck!!!
The solution that worked for me is related to (what I think is) a change of path behavior after upgrading to Xcode 4.2:
You can no longer manually enter "armv6 armv7" but must enter $(VALID_ARCHS) instead: both for the Architectures and Valid Architectures fields under the Architectures section in your project's Build Settings pane. Xcode will automatically replace the statement with 'armv6 armv7'.
This string looks exactly the same as if you would have typed it in manually but nevertheless point to the actual correct paths that will be generated along with your build, ...or at least this is my take on it :P
Unrelated, we used to have "armv6 armv7" as well under Other Signing Flags and now took that out and it works fine. This must be just an extra.
Thanks and happy hacking.
Gon
I went to Key Access, selected the private key, and added XCode to the list of apps that can access it. That worked for me
If anyone uses Xcode ver. 3.x.x and upgrades from Mac OS 10.7 to 10.8, dev. tools will work just fine except the new codesign binary .. To fix that just copy the old codesign and codesign_allocate binaries (I hope you have backup) to /usr/bin/ folder and rename or backup the new one.
I had special characters in the project name,renaming it to remove the characters, question marks, and insuring a developer certificate was enabled fixed the issue.
When I experienced this error, it was due to having been in Keychain Access, and choosing 'Disallow' when asked whether I wanted to let the program access a saved password. Going back in and selecting 'Allow' and typing my system password fixed the problem in XCode.
For me the problem was HTTP proxy
Here is how I solved the same problem. It may help someone.
I deleted the Development Provisionning Profile (that I was using) from the server, then created one with a slightly different name.
I used it and it worked.
This issue happened for me when I had multiple targets in one project, and I changed the CFBundleExecutable plist property to something other than the target's name.
So, for example, I had the following targets in one project:
SomeApp
SomeApp WatchKit Extension
SomeApp WatchKit App
SomeApp Today Widget
SomeApp for OS X (this is the target where the codesign error happens)
SomeApp for OS X had its CFBundleExecutable property set to just SomeApp, which not only conflicted with the first target called SomeApp but was different from the target it was meant for. Changing SomeApp for OS X to SomeApp and then renaming the first target worked fine for me.
For me I had code coverage enabled on the scheme of a framework rather than it's corresponding test scheme. Disabling the code coverage sorted the problem.
A very simple answer to this very-complicated question. It involves no knowledge of code-signing and everything connected with it.
Take an old app that is not needed any more. Make sure it works, then replace its code with that of the new app having the code-signing error. The old app should now work fine, accomplishing what you wanted with the new app.
Only down side: the working app has the title of the old one.

Resources