(to aid search)
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.
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