command/usr/bin/codesign failed with exit code 1- code sign error
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, usecmd + 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/
How to fix Command /usr/bin/codesign failed with exit code 1 error
Your issue is probably caused by the wrong signing identity you have selected
Signing Identity: "-"
Seems to be an invalid signing identity
Try to select a valid signing identity on your project's signing settings:
Target build settings -> Signing
/usr/bin/codesign failed with exit code 1
Update:
The Technical Note in my original answer is now deprecated. Apple posted a collection of code signing problems (and some solutions) in a new document: Technical Note TN2407 Code Signing Troubleshooting Index
Check the CODE_SIGN_IDENTITY property in your build settings. Is your provisioning profile selected there?
You also need to enter a valid bundle identifier in your apps .plist.
The identifier has to match the one you provided when generating the profile.
Apple has a technote about that here.
Xcode Signing Failed Command /usr/bin/codesign failed with exit code 1
In case, if you are running on a device it gives this error because of the following reason:
The signing identity of provisioning profile you are using is Distribution profile as I can see from this error:
Signing Identity: "iPhone Distribution: pocket queries, Inc. (PXS8PN3EZZ)" Provisioning Profile: "plantapp_dis" (b7ae657e-8ceb-4d15-8ba3-889429c28b48
Distribution provisioning profiles are meant to use for archieving and distributing it to Appstore. Not for running on a device. You need to use development provisioning profile for that purpose.
You can change your provisioning profile in build settings -> code signing identity or
General->Automatic code signing
Command /usr/bin/codesign failed with exit code 1 on Xcode 11
In Keychain Access... The solution was right clicking on Apple Worldwide Developer Relations Certification Authority and select Get Info. In the Image bellow, I've change When using this certificate to Use System Defaults and the system asked me to put password. Now it's working \o/
Xcode Command /usr/bin/codesign failed with exit code 1 : errSecInternalComponent
Open Keychain Access, then in the File menu select Lock All Keychains.
Then go back to Xcode and clean and rebuild. It will prompt you for your password again to unlock the keychain.
After this, assuming you have no other compile issues, it will succeed!
Related Topics
How to Implement Lazy Loading of Images in Table View Using Swift
Error: Initializer for Conditional Binding Must Have Optional Type, Not 'String'
Nsfetchedresultscontroller V.S. Uilocalizedindexedcollation
Nsmutableurlrequest Timeout Interval Not Taken into Consideration for Post Requests
Custom Rounding Corners on Uiview
Get an Array of Property Values from an Object Array
Autoshrink on a Uilabel with Multiple Lines
Swift - How Creating Custom Viewforheaderinsection, Using a Xib File
Getting a Device Udid from .Mobileconfig
How to Change My iOS Applications' Entitlements
Simple and Clean Way to Convert JSON String to Object in Swift
Push Notification Not Receiving in Background iOS
Change the Width of Master in Uisplitviewcontroller
Monotouch/Wcf: How to Consume the Wcf Service Without Svcutil
How to Detect One Button in Tableview Cell
Animate Uilabel Text Between Two Numbers
iOS 8 Auto Cell Height - Can't Scroll to Last Row
How to Distinguish Between Locking the Device and Sending an App to Background