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

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.

Related

Xcode 8 A valid provisioning profile for this executable was not found

I know there are other questions asked like this here but I've followed all their solutions yet still end up with this error message.
I have a valid Apple Developer account with program active.
I have tried using managed and unmanaged provisioning with new/fresh bundle ID's (which get recreated provisioning profiles).
I have tried this: A valid provisioning profile for this executable was not found for debug mode
I have tried this: XCode :7 App installation failed :A valid provisioning profile for this executable was not found
I have deleted any old versions of the app from my phone.
I have confirmed my device ID on the developer portal is the same as in Xcode (was also useful for manual provisioning profile management to confirm)
I even tried another developer ID I have out of sheer desperation and yet the same error appears.
I even get this error when building for release scheme with my valid distribution certificate.
I've spent a ton of time trying to figure this out now I'm hoping someone else has felt my pain and actually solved this.
UPDATE: Adding screenshots for usefulness
UPDATE 2: I gave up trying to solve this problem, I created a new project and copied source files into the new project and I now have it working. Clearly something in the project configuration/settings files got corrupted somehow in the previous project which no obvious fix available. Will leave this question open, perhaps someone has a solution eventually. I have my old 'non-working' project so will continue to try those just for curiousities sake.
Before this error message, Build Succeeded is shown.
ATTENTION!
Who should read
If you were developing with a "Personal Team" and is switching to a paid team, then you'll get this error if you have not updated your other targets as well.
The cause
Since I'm using react-native, I happen to have a target for test (i.e. a target called appTests), and switching the team just in one target wasn't sufficient, and leads to this error. This error isn't informative enough to let you know there's an error in one of the targets, therefore leading to a long debugging time for myself.
Solution
1) On Xcode 9, go to every targets and update the team!
2) Unfortunately, the next steps aren't very reliable from my experience, you might have to do your best to clean the caches.
3) Stop every single running scheme/application by using the stop button
4) Go to Product -> Clean and cleans every schemes you use.
5) Quit and Restart Xcode
6) Run again and hopefully it works! If not, it's likely some cache are still present.
You can't install a build that was signed with the app store distribution provisioning profile and certificate (I'm assuming your release scheme is set to use your app store cert and profile). It will fail to install on the device if you try. You need to use either a development profile, or an enterprise distribution profile to install on test devices. The iOS Distribution certificate can only be used to build an app that will be installed via the App Store.
Thats a conflict of Xcode. The way I solved it is by deleting the derived data of Xcode.
Xcode > Preferences > Locations
You will see an arrow right from the path of the DerivedData which will open them in finder. Just erase everything in the folder.
Update: According to Chandler's comment check if there is a need to delete the test target.
I solved it by changing the build system to legacy in Xcode 10
File > Workspace Settings > Set Build system to "Legacy Build System"
It works when I also add the correct signing for myProjectTests. This was the last thing I did after trying all sort of solutions for 5 hours.
I followed many proposals but it didn't work until I unchecked Automatic signing for the TESTS
Clearing the DEVELOPMENT_TEAM and DevelopmentTeam entries in the xcodeproj/project.pbxproj file worked for me.
I'm on 8.2.1 and just had this same error. Deleting the original project folder and recreating it worked seamlessly. I verified that all of the signing and provisioning certificates were exactly the same as the last project. I'm not sure where the issue lies, but I believe your assumption of corrupted files is accurate.
In my case it was a conflict with the development team.
I've solved by opening my xcodeproj/project.pbxproj and emptying the following variables:
DevelopmentTeam
DEVELOPMENT_TEAM
We had a similar issue: we deleted the Unit Tests and it worked.
In my case, it was the problem when I setup my time manually two month earlier on my iPhone. But when I changed to set time automatically, it worked fine.
Setting -> General -> Date & Time -> set time automatically
GOTO: Targets->yourProjectNameTest and verify that team is the same as on yourProjectName
I had this problem too, and for me the solution was to sign in to https://developer.apple.com. There was a red bar, going like "our TOS have changed, you have to accept them again", I did, and then my provisioning profiles worked again immediately.
An easier fix is to uncheck the test target as part of the Analyze & Run steps in Edit Scheme > Build -> Build.
This is very specific to React Native projects, since this is how the projects are configured by default.
In my case it worked for me to follow the instructions in this article. Then disable Automatically manage signing inside xcode in the general tab.
Automatically manage signing disabled
And finally provide manually Provisioning Profile for Signing (Debug) and Signing (Release)
Note: The Provisioning Profile you must generate it from Apple Developer Program website, in the section Certificates, Identifiers & Profiles -> Provisioning Profiles
I hope you find it useful. regards
Step to be followed
must have a developer account - https://developer.apple.com
create a certificate for development
Add devices with UDID
add provisioning profile in development
sign in Xcode with your account
clean build
Build with any destination choose device I have done for iphone 6
the archive will be disabled first, the archive will be active by choosing
generic ios device from the right corner of Xcode for example ->
yourAppName>generic ios device
once archive is done build for development not ADHOC
done
I fixed it by setting in main Target / Build Settings / Section Signing
Code signing Identity: Debug and Release set to IOS Developer
Code Signing Style: Automatic
Provision Profile: all automatic.
I set this exactly same for Test Target.
Then i was able to run release version on my phone. Btw i dont know what is the difference between IOS Developer and iOS Distriobution though.
I had edited my app scheme Build Configuration from Debug to Release, and unchecked the Debug Executable.
I am not sure why, but if it makes a difference my signing details for Debug and Release were different. So after I reset those back to Debug and checked back the Debug Executable box, and all was fine again.
Edit: found out it was because I was trying to run release mode on my phone via App Store provisioning profile and App Store profile doesn't allow this. I switched to Ad Hoc and there is no more issues.
I guess you already tried this, but I just got the same error, and a quick restart of Xcode worked for me.
Just upgrade to Xcode 8.1. It solves the problem.

(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 {} \;

Code Sign error: No unexpired provisioning profiles found that contain any of the keychain's signing certificates

I think I've reached the nadir of iOS provisioning hell. After migrating to a new mac and doing an archive for distribution, I received the error:
Code Sign error: No unexpired provisioning profiles found that contain
any of the keychain's signing certificates
I then erased all certs and keys and provision profiles and did a "hard reset" (deleting all keys, certs, and profiles), following Apple's instructions by hand, with the same error. Then I did another hard reset and then had Xcode handle the whole thing via the Organizer, did another archive - only to see the same error.
I have all certs (WDRCA, Developer ID Cert Authority, iPhone Dev, iPhone Distribution) showing in Keychain Access, Xcode shows that it sees the dev and distribution certs, as well as the provisioning profiles, all marked with a green checkmark and "valid" status.
Code signing within the app show the correct dev and distribution is selected.
What's really troubling is that a Google search on the error shows one tech note from Apple that isn't very helpful, 2 tweets, and 3 results in Japanese - and nothing else. I contacted one of the tweeps and he said he fixed it with a hard result, which I have done twice.
Any ideas on where to go or what to do next?
Fixed it by Organizer -> Teams (select Your Team) -> Refresh (low right corner).
After removing all devices/profiles/certificates and adding/creating it did still not work here too....also removing the Xcode prefs did not help.
but it seems to in the project settings, check in the build settings under CODE_SIGN_IDENTITIY, in my project the first line was set to a old profile but not visible in the list, only if you open the pulldown, after removing that it worked.
I just had this problem as well. I finally realized that the identifier is case sensitive. For example if your product name is "StackOverflow" it automatically tags the identifier with com.yourcompanyname.StackOverflow. (this of course can be changed by going to the summary of the target). The problem lies in what the app id is in the developer portal. Make sure that the identifier in the portal matches what's in Xcode.
I have the same issue here since Xcode 4.3 install (moving from /Developer to /Applications). I found this post for changing the Xcode dir
in the terminal check what path it is set to with:
/usr/bin/xcode-select -print-path
and then if it is still set to /Developer set it to /Applications:
sudo /usr/bin/xcode-select -switch /Applications
which worked for me to be able to do the update to 4.3.2 but this did not resolve the issue mentioned....so maybe it helps you.
After nine hours of hair pulling, cursing and burying my head in my hands... All I had to do was create a new project, transfer the files over by hand, and the error went away. Argh.
Update: My marking my own answer as correct does not mean these other answers were wrong - I didn't get a chance to try any of them.
i 've met the same problem.
the answer of the problem is simple.
you need to login your apple develpoer web site
to apply and download a profile for your app .
after double-click the download file ,
you can see the file in organization of the project in xcode .
the name of the bundle id is the type like com.yourname.appname
the xcode device choose the ios device
and the codesign of the target should choose distribution
which is one of the file in organization of the project in xcode .
f.y.i.
A few days ago I had exactly the same problem.
The issue is related to no having the correct distribution provisioning profiles; My error was that I added a new device to the portal and did not re-download the distribution profile from the developer site.
Today I had the same issue; while it was working perfectly with the developer profile i could not archive or build a distribution package..
I had to go to the portal and manually re-download my distribution profile because new hardware was added even though I am not actively using it on the developer profile (did not check the box to add it to the provision)
Hope it helps anyone
I went straight to "but it seems to in the project settings, check in the build settings under CODE_SIGN_IDENTITIY, in my project the first line was set to a old profile but not visible in the list, only if you open the pulldown, after removing that it worked."
And that seems to have done the trick.
I fixed it by updating the bundle identifier in the project settings > targets > appName
in the info tab.
I had this problem, and fixed it by putting my scheme back to Debug, as opposed to Release.
I faced the same problem after upgrading to Xcode 4.3.2 and SDK 5.1. Everything worked perfectly in the previously version of Xcode with SDK 5.0. After many hours of hair pulling I created a new distribution certificate in the iOS Provisioning Portal->Provisioning-> Distribution Tab and after downloading it and installing it into Xcode (drag-and-drop) it works to archive after selecting the new certificate in the Code Signing area for my target.
I had the same problem after upgrading the OS/xcode so its worth to try.
the solution for me was simple,
go to the ios provisioning portal.
make sure the app certificate for the app is valid and not expired.
download again it again and double click it to install.
it should fix the problem.
I had this error when trying to build a release version - no problem occurred for debug builds. Baffling because in the code signing section of the build settings I had the same profile selected.
The solution for me was to create and download a new distribution provisioning profile, even though from the settings it appears not to be used.
I found a solution that was not on here, after looking through the errors and looking into my raw .app file, i found the solution.
Go to your target, and then "Build Phases" instead of Build Settings.
Make sure that in "Compile Sources" is your storyboard. For some reason Xcode didn't add the storyboard to this area of my file when I coppied the storyboard in.
P.S. I had to add the other .m's that i wanted in the project to this area as well (the ones that I dragged in, not created in the project)
Hope this helps
In the Target settings, in Sumary, check if Bundle Identifier is exactly the same as in itunesconnect.com
as example:
Bundle ID: com.mycompany.myapplication
I fixed mine by Analysing instead and checking that error. It indicated that my bundle ID was not lowercase as in the provisioning profile.
I actually was having this issue but whenever I tried to get into the organiser it caused XCode to crash. To resolve this issue I went into my targets and changed everything under Code Signing Identity to iPhone Developer. The target defaulted to the provisioning profile I wanted and it worked.
What worked for me is to choose "Don't code sign" and then do a build. This generates an error, but seems to clear out whatever xcode is hanging on to. Then choose the right provisioning profile and build. This has solved similar problems for me in the past.
Fixed it.
Went to Project-> general-> found an option "no provisioning profiles found" Fix Issue button. Clicked it . Automatically fixed
Reason Of Error
If you don't have any valid provisioning profile downloaded to your system's Library/MobileDevice/Provisioning Profiles folder then you might run into this error.
Solution
Login to your Apple Developer Account from Xcode->Preferences->Accounts and then download a valid provisioning profile.
Move to Target->General and select the correct Team.
Now go to Project Build Settings->Code Signing Identity and select just 'iOS Developer' and 'Automatic' in Provisioning Profiles. Your app will run smoothly.
In the Build Settings look for
General > Identity > Bundle Identifier and Team Settings. Fill in the Bundle Identifier and select Team. (this basically your publishing info). Of course as the others have written you'll need the correct dev or team account. This solution worked for me and resolved the build error.
Its because of the SUDO permission you have given while adding the platform.
Follow this link Ionic Code Sign error: No unexpired provisioning profiles

Xcode asking username & password every time I compile to device

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.

Resources