Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode fails with "Code Signing" Error

Alternate Titles

(to aid search)

  • Xcode 'CodeSign error: code signing is required'
  • Xcode: iPhone app codesign error
  • /usr/bin/codesign failed with exit code 1
  • Jenkins fails with Code Sign error
  • Command-line build fails with "provisioning profiles not found"
  • Archiving Xcode project fails with provisioning error
  • Missing signing certificates in Xcode

Symptoms

The issue manifests it's self in one of several ways:

  • Running your app on a device results in an error referencing "code signing" or "expired signing certificates"

  • Building from the command line (or using a continuos integration system, such as Jenkins) fails with a error similar to this:

      Check dependencies
      Code Sign error: No unexpired provisioning profiles found that contain any of the keychain's signing certificates
    
  • Archiving an app fails with "code signing" or "expired signing certificates" where a run or build work correctly.

Often the project may have several configurations and sometimes only a subset will fail. Deleting and regenerating provisioning profiles has no effect.

like image 548
Richard Stelling Avatar asked Dec 19 '12 22:12

Richard Stelling


People also ask

How do I enable signing in Xcode?

Open the project using Xcode. Select the root project directory, and go to the Signing and Capabilities tab. Here, you can either check Automatically manage signing or do the signing manually. If you check the Automatically manage signing checkbox, then you will just need to select the Team from the drop-down list.

What is code signing in Xcode?

Code signing your app assures users that it's from a known source and hasn't been modified since it was last signed. Before your app can integrate app services, be installed on a device, or be submitted to the App Store, it must be signed with a certificate issued by Apple.

How do you change Code Signing Identity in Xcode?

The automatic setting should automatically use the correct certificate to sign your app with based on the provisioning profile set in the bottom option in the Code Signing section. You can explicitly set both the Code Signing Identity as well as the Provisioning Profile, or set the Code Signing Identity to Automatic.


2 Answers

CODE_SIGN_IDENTITY verification script.

Often in set ups that use version control the project.pbxproj can be merged in such a way that two CODE_SIGN_IDENTITY lines can be inserted. This seems to cause Xcode problems under certain situations (like command-line builds or archiving).

A tell-tail sign is lines similar to this in the project.pbxproj file (right-click on the project and select "Show Package Contents…")

"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_IDENTITY = "iPhone Distribution";

Deleting one of these lines will let you select the correct value in Build Settings and the project should once again build correctly.

I have created simple script to help diagnose this issue it can be found here: https://github.com/rjstelling/Xcode-Project-Validate

like image 171
Richard Stelling Avatar answered Oct 09 '22 02:10

Richard Stelling


I got this code sign error with an Open Source Github project which I only wanted on my own device (not in store or anything) and I don't have a paid membership account.

In that case it's meanwhile (since XCode 7) possible to configure and allow your app as unsigned but trusted.

It's all explained here: https://stackoverflow.com/a/4952845/828184

like image 31
CodingYourLife Avatar answered Oct 09 '22 03:10

CodingYourLife