/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 Error: Command /usr/bin/codesign failed with exit code 1
You've almost certainly got corrupted certs :
Revoke old certs, generate new ones, new provisioning profile, the works, magic happens again
Jenkins - Xcode build works codesign fails
We don't use Jenkins but I've seen this in our build automation before. Here's how we solved it:
1) Create your build Keychain. This will contain the private key/certificate used for codesigning:
security create-keychain -p [keychain_password] MyKeychain.keychain
The keychain_password is up to you. You'll use this later to unlock the keychain during the build.
2) Import the private key (*.p12) for your CodeSign identity:
security import MyPrivateKey.p12 -t agg -k MyKeychain.keychain -P [p12_Password] -A
The key here is the "-A" flag. This will allow access to the keychain without warning. This is why you're seeing the "User interaction is not allowed" error. If you were attempting this build via the Xcode UI, this is the point where it would prompt you to "Allow access" to your keychain.
3) However you're saving the Keychain (e.g.: checking it in to source control), make sure it's writeable and executable by your build user.
When you're ready to build, add the following prior to running xcodebuild:
# Switch keychain
security list-keychains -s "/path/to/MyKeyhain.keychain"
security default-keychain -s "/path/to/MyKeychain.keychain"
security unlock-keychain -p "[keychain_password]" "/path/to/MyKeychain.keychain"
If you're running locally, you may want to add something at the end of your build script that switches back to the login keychain (~/Library/Keychains/login.keychain), e.g.:
# Switch back to login keychain
security list-keychains -s "~/Library/Keychains/login.keychain"
security default-keychain -s "~/Library/Keychains/login.keychain"
Give that a try. We create a separate Keychain for each identity we use (our own plus builds on behalf of customers). In our company's case, we have both an AppStore and Enterprise account. This can result in naming conflicts while codesigning (e.g.: both accounts resolve to "iPhone Distribution: ACME Corporation"). By keeping these identities in separate keychains we avoid this conflict.
Application failed codesign verification?
Your Build settings appears to have a DEVELOPER certificate for the RELEASE version.
In order, to validate and submit a binary you've to configure the release version to use a DISTRIBUTION certificate.
Create and download a Distribution certificate and import it (drag and drop to Xcode).
Configure the build/release for using the distribution certificate. If you don't see the new distribution certificate as an option for your build, check the AppleID used both for generate the certificate and for your Build settings. They must be the same, otherwise Xcode can't sign your app correctly.
This will solve your problem.
Stuck with Command /usr/bin/codesign failed with exit code 1 Error
I have seen this error when I manually built and signed an iOS application bundle using a Makefile. In that case my Info.plist
was missing the CFBundleResourceSpecification
key (should probably have the value ResourceRules.plist
). I did some more testing now and it also happens if the key CFBundleExecutable
is missing.
CFBundleResourceSpecification
should be added in some build phase by Xcode but maybe it's a good idea to check the resulting Info.plist
in the build directory if it's really there.
Maybe this blog post could help, it's about codesign
finding the wrong Info.plist
file (one without CFBundleResourceSpecification
)
http://infinite-sushi.com/2010/08/the-case-of-the-missing-cfbundleresourcespecification/
Code Sign error: The identity 'iPhone Developer' doesn't match any valid certificate/private key pair in the default keychain
This happens if you forgot to change your build settings to Simulator
. Unless you want to build to a device, in which case you should see the other answers.
Code signing issue with embedded frameworks
The issue in my case was empty "PRODUCT_BUNDLE_IDENTIFIER
". Even though CFBUNDLE_IDENTIFIER
is set, xcodebuild expects it(PBI) too in case of embedded frameworks.
But it is really strange that only few of the builds are corrupted.
clang: error: unknown argument: '-no_adhoc_codesign'
You can use -Wl,-no_adhoc_codesign
to pass the option directly to the linker if the compiler doesn't support adding the option itself.
XCode: Could not launch APP_X_Y - 'A' packet returned an error: -1
If you create a new project from scratch, can this new project connect to the simulator? In that case I suggest just moving over the existing code and settings to a fresh project. I've had to resort to this at least once that I can remember because something fishy had gone wrong with the XCode project file.
Related Topics
Swift 3 - How to Make Timer Work in Background
Press-And-Hold Button for "Repeat Fire"
Typewriter Effect Text Animation
How to Add an Identifier to Auto Layout Constraints in Interface Builder
Fix Cordova Geolocation Ask for Location Message
Hashtags in Arabic Language Crashes the App
Distanceinmeters Problems with Arrays and Sort
How to Set Cornerradius for Only Bottom-Left,Bottom-Right and Top-Left Corner of a Uiview
Open Links in Safari Instead of Uiwebview
Uitextview Linespacing Causes Different Cursor Height Inbetween Paragraph Lines
How to Fetch All Images from Custom Photo Album - Swift
Error Itms-90086 Submitting App
Prevent Dispatch_After() Background Task from Being Executed
Nsurlsessiondatatask Datataskwithurl Completion Handler Not Getting Called
How to Send Data from iPhone to Apple Watch in Os2 in Objective-C
Audiokit: Using the New Aksequencer with Any Variety of the Callback Instruments