Thursday, October 15, 2009

Troubleshooting Code Signing Errors in XCode

A lot of people get “Code Signing” errors when testing iPhone apps on their iPhone in XCode. Here are a few simple steps you can take to try to right yourself and get working again…

Check Your Certificates and Keychain

First, make sure you check your Certificates. Make sure that the Login keychain is set to be default. You will be getting a message stating, “A valid signing identity matching this profile could not be found in your keychain” in Organizer. Go into keychain access, right-click on the Login keychain and make it the default.

If you select the Login keychain and “My Certificates” below it, you should see your “iPhone Developer” and “iPhone Distribution” certificates with the private key attached and valid. The root certificate for the “Apple Worldwide Developer Relations Certification Authority” should also be present in the system keychain. If it is not, you need to go to the iPhone Provisioning Center and download the “Apple Worldwide Developer Relations Certification Authority” certificate.

Check to make sure XCode is allowed access to the private keys below your iPhone Developer certificate. Right-Click on the private key and select Get Info. Make sure it is set to “Confirm before allowing access.” Then make sure the following applications are set to always being allowed: codesign, Certificate Assistant (two ones), Mail, iChat, and raccoon.

Check your Profile

Make sure that you actually have a suitable profile loaded onto the device. The easiest way to check is on your iPhone. Tap Settings/General/Profiles to make sure your profile is on the phone.

Check Your Build Settings in XCode

This is a big one. You need to check if you are using the correct Code Signing Identity. Make sure to check both the project root build settings as well as the settings specific to your target. They might be different!

In the latest version of XCode, you can choose “iPhone Distribution” and it will automatically match your ad-hoc profile.

Check Your Build

Now you also want to make sure that both the correct certificate is used and that it is embedded. You should routinely Build – Clean All Targets when you are ready to do the final build for a release.

Finally…Reboot Your Computer

If nothing else has worked, you can try out option to “Empty Caches” under the XCode menu item and build again.

Also reboot your iPhone…stranger things have happened.


Chad

chad@palmbeachsoftware.com

http://www.PalmBeachSoftware.com

No comments:

Post a Comment