how to fix iphone code signing errors

January 4, 2009

This post is a collection of all code signing solutions, including my suggestions, in one place.

You can find fixes for issues like:

  • distribution profile not showing up in xcode
  • packaging is using the wrong folder
  • no packaging or code signing done during build
  • code signing with the wrong certificate
  • error during app upload saying the app has been signed with invalid certificate

If you are experiencing any of these issues, please read on…

I apologize in advance for the lengthy discussion… I’ll probably create a cliffnotes version of the best solution at some point.

NOTE: in the 2.2 version of the SDK, the Code Signing Identity and Provisioning Profile settings have been merged, so you set both in the Code Signing Identity field. I usually call out both settings in this post to be backwards compatible, if you are using 2.2+ SDK just ignore the Provisioning Profile filed in the screenshots and text. I actually preferred the old way, becuase I have multiple profiles and now all I see in the settings is iPhone Distribution: Your Name. To see what profile is being used I actually have to click on the field to bring up the list. Insane.

You should really read the whole thing. If you are here, you’ve probably already spent hours or even DAYS code signing. It’s easier to fight the evil if you know more about it.

But if you are in a hurry, jump to Sanity checks then to Exercise 4.

<rant alt=”highly therapeutic”>

Just so you know you’re not alone.

Last week I added some features to sketchinz, one of my iphone apps. Everything went fabulously: my classes are well designed and I am quite comfortable with the specific part of the sdk so it was as easy as it would be for Joe the Plumber to hook up the hot water to the hot water and the cold water to the cold water.

I was on a roll, all done in 30 minutes. A quick look at the clock: 11:30pm. I’ll quickly package it all up, submit my update, and pick out a dark comedy on Netflix instant watch…

Little did I know that for the next two hours I will be beaten, cubed and ground into hamburger meat by Apple engineering’s probably most ingenious attempt to one up Turing’s theory of the “halting problem”: code signing.

This was supposed to be easy: the certificates were correct and installed. I’ve successfully signed and posted this app before. I haven’t changed any build settings. The certificates are still valid. I read the manual. I followed each step. I can make a wedding cake from scratch. I can even make sausage from scratch.

wedding cake and sausage made by me

wedding cake and sausage made by me

Apparently Apple knows that code signing has issues. There are some suggestions on the program portal to fix code signing (as in delete all information, restart and retype all information- feels like reading a Windows 3.0 manual.) So why don’t they fix it? Good question. Maybe they read this post, get angry and fix it…

I mean how hard can this be? Look up two field values and execute a script with those arguments? Geezus. In fact I have another question:

Why do developers have to bother with code signing at all? Why are the apps not automatically signed when uploaded to the store?

Now that I’ve got it all out let’s look at some solutions after we reread the first step of code signing anonymous:

Step One: We admitted we were powerless over code signing - that our lives had become unmanageable.

</rant>

These solutions assume that you have valid certificates and the certificates are installed. Before we get too far into it, let’s do some:


Sanity checks

1. Make sure your keychain has the Apple WDR certificate, your distribution certificate and under it the private key used to create the certificate. This is best checked by setting the Category to Certificates. Click the triangle next to the certificate to see your private key. You should see something like this:

keychain certificate view

keychain certificate view

* If you don’t have a private key (no triangle) because you got a new computer, reinstalled osx, or are using your boyfriend’s computer and you have not exported your private keys (hint, hint, hint -> export your private keys now), you’ll need to throw away all your certificates and provisioning profiles and create new ones on the program portal.

* I figured I could blur my name on the images, but then you could just scroll up a bit and see it anyway. So I decided to not go through the hassle.

2. Make sure that the provisioning profiles show up in the {YOUR_HOME_DIRECTORY}/Library/Mobile Provisions folder. The profiles might have the original name as you downloaded them from the program portal or they might have been renamed to their ids if you installed them by dropping on xcode. They will work either way.

provisioning profiles folder

provisioning profiles folder

3. This is just a suggestion: I create wildcard app ids for all my apps so I don’t have to worry about the Identifier setting in the Target Info / Properties tab. You can leave the default string: “com.yourcompany.${PRODUCT_NAME:identifier}”, or you can change it to whatever you want. To create a wildcard app id in the program portal, just put an asterix in the App ID field as below:

wildcard app id

wildcard app id

Ok, let’s look at the first evil.

“distribution profile not showing up”

The Distribution configuration is created by duplicating the Release configuration. At the target level enter iPhone Distribution: Your Name in the Code Signing Entity field. When you click on the Code Signing Provisioning Profile field value, you should see something like this (sketchinz profile showing):

distribution profile showing

distribution profile showing

Sometimes, however, you are presented with no provisioning profiles like this:

distribution profile not showing

distribution profile not showing

Before we go much further, let’s do some easy checks:

1. Make sure you have the Distribution configuration set active.

distribution configuration active

distribution configuration active

2. Make sure you are modifying the Distribution configuration.

modifying distribution config

modifying distribution config

2. Make sure there’s no typo. The code signing identity field should match the name of your certificate in your keychain. It’s case sensitive.

3. Make sure that there is one space between “Distribution:” and “Your Name”.

4. There should be no space before “iPhone” and no space after “Your Name”.

Excercise #1

Leave your project open in xcode and create a new project. Create a Distribution configuration, enter iPhone Distribution: Your Name in the Code Signing Identity field and see if your profiles show up here. If they do, it’s your lucky day because most likely they will show up in your original project now.

I think this was originally suggested at v2ex.com in this post.

Excercise #2

1. Do a “Clean All” in your project.

2. Delete the value in the Code Signing Identity field.

3. Exit xcode.

4. Go to the build folder for your project and delete everything. (Especially the folder called {YOUR_PROJECT_NAME}.build.) The build folder is usually located right in your project’s folder, if it’s not there you can find the loction in the project’s info window under the General tab.

5. Restart xcode, fill in Code Signing Identity and see if your profile shows up. If it does, it’s your lucky day.

6. If it doesn’t you can try this again, but restart your computer before restarting xcode. If your profile shows up now, it’s your lucky day.

This method is suggested on the program portal by Apple.

Exercise #3

It’s possible to set a value for the Code Signing Identity and Provisioning Profile at both the Project and Target level. And it’s possible to set different values in two places!

In theory this should not be a problem. If a value is not set at the Target level, it falls back to the value at the Project level. If a value is set at both places, the Target level value should have priority.

It seems however that xcode sometimes gets, hmm, confused. In fact if you followed the directions from the program portal, you will have iPhone Developer set at the Project level and iPhone Distribution: Your Name at the Target level for the identity.

Set the identity to iPhone Distribution: Your Name at the Project level. If your profile shows up, it’s your lucky day.

If not, do a Clean All, exit xcode, delete the contents of the build folder and restart xcode. If your profile shows up, it’s your lucky day.

Most likely by now your distribution profile shows up. If not, the move on to the next exercise that should also help with:

“no packaging or code signing during build”

“code signing with the wrong certificate”

Exercise #4

The program portal instructs to verify code signing by looking at these two lines in the build out

ProcessingProductPackaging “/Users/lajos/Library/MobileDevice/Provisioning Profiles/sketchinz.mobileprovision” /Projects/iPhone/deleteme6/build/Distribution-iphoneos/deleteme6.app/embedded.mobileprovision …

CodeSign /Projects/iPhone/deleteme6/build/Distribution-iphoneos/deleteme6.app
cd /Projects/iPhone/deleteme6
/usr/bin/codesign -f -s “iPhone Distribution: Lajos Kamocsay“…

By the way to look you can look at the build output in the build tab (shortcut: command+shift+B) by clicking this button:

xcode build output

xcode build output

Your app is correctly signed when:

1. product packaging uses the correct provisioning profile

2. product packaging outputs the embedded.mobileprovision into the correct .app build folder

3. code signing uses the correct identity

On a side note, I suggest installing the provisioning profiles by manually copying them into the {YOUR_HOME_DIRECTORY}/Library/Mobile Provisions folder rather than dropping them on xcode because when dropped on xcode the files are renamed to their ids. If you copy them by hand the file name will remain consistent with the build settings and the build output. (You can open up the certificates and look at the ids by the way, but why bother with remembering hex values at 3 in the morning.)

So how can xcode use the wrong certificates?

As discussed in Exercise #3, the Code Signing Identity and Provisioning Profile can be set at both the Project and Target levels. If the values are different, xcode seems to get conused sometimes. In my experience fixing the discrepancy had sofar eliminated the code signing issues from above. (There is one more issue coming later, the most evil of them all that needs even worse measures.)

In this exercise I will suggest something contrary to the instructions on the program portal. Instead of setting the Code Signing Identity and Provisioning Profile at the Target level, we’ll only set them at the Project level. The Target(s) will inherit the settings the Project and life will be as sweet and naughty as chocolate cake.

1. Make sure that there are no values set in the Target Build info. Xcode displays values set here in bold:

xcode target set

xcode target set

(You can also set the Show option to Settings Defined at this Level, and you want to make sure that Code Signing Identity and Provisioning Profiles don’t show up there.)

2. To reset them, select the line where the value shows up and hit the ‘delete’ key. Both values should now appear in normal font weight:

xcode target unset value

xcode target unset value

3. Go to the Project Build info, and set the Code Signing Identity and Provisioning Profile.

xcode project distribution profile set

xcode project distribution profile set

4. You might need to do the magical xcode voodoo dance of “Clean All”, exit, delete everything in the build folder and restart xcode, but by now that should be second nature. Kind of like washing hands before one touches its own self.

The only situation this approach would not work conveniently is if there were multiple targets all with their own provisioning profile. I have no idea why anyone would impose such hell on hirself.

In fact, I have no idea why the hell would anyone use a non-wildcard app ids. I guess some people like self torture while some others are following stupid arse executive orders. If you are using non-wildcard app ids and don’t fall into either of those categories, this is your chance to redo your profiles with wildcard app ids (discussed somewhere above.)

And now let’s look at the worst of them all:

“product packaging uses wrong .app build folder”

Exercise #5

This one is pretty easy to recognize. The .app build folder on the product packagin line is pointing to a different configuration (eg. Release) or a completely different .app.

The only solution I’ve found for this one is to:

1. duplicate the target

xcode duplicate target

xcode duplicate target

2. delete the old target

3. rename the new target (take the ” copy” off the end)

4. when duplicated, xcode creates a copy of the Info.plist file. To fix, go to the Target Info, select all configs, and search for info -> change Info copy.plist back to Info.plist. (You should also delete the Info copy.plist file from Resources.)

xcode target info copy.plist

xcode target info copy.plist

Now try to “Clean All”, delete old builds and restart xcode. Cross the fingers and build.

“no ProcessingProductPackaging line in build output”

This solution comes from Jonathan Mulcahy. Here’s his discription of the problem:

The app builds fine and runs on my iPhone fine. When I try to build
the Distribution app, it builds fine with no errors, but when I look
at my build log, I do have the CodeSign entry, but there is no log
entry for ProcessingProductPackaging part, so the
embedded.mobileprovision does not exist.

He also noticed that in the Code Signing Identity options it said “All Code Signing Certificate Identites” instead of the name of the mobileprovision. (click on image to see full size)

missing mobileprovision name

missing mobileprovision name

You should see the name of the mobileprovision, like in this case sketchinz:

mobileprovision name showing

mobileprovision name showing

So the solution:

Exercise #6

Remove the iphone SDK and reinstall it, preferably the latest version (at this time 2.2.1).

Thanks Jonathan for this contribution!

Final thoughts

  • don’t give up- it will work
  • feel free to contact me if you are still stuck or have any additional info to share with the world

74 Responses to “how to fix iphone code signing errors”

  1. Dear lajos,

    I am having an issue with the build process fro my app. The problem is that after a clean build, no where in the build log are mentioned ProcessingProductPackaging or CodeSign even tho I fallowed all the official instructions and all of you unofficial recommendations. It seems like xcode is just not attempting to sign at all… Amy suggestions would be helpful. Thanks!

  2. @Bungler-> Sent you an email.

  3. Hi lajos,

    I just sent you an email, I’m having a similar problem as Bungler, I have no mention of ProcessingProductPackaging at all. I do see CodeSign however.

    Thanks!

  4. Thanks a bunch for the info. I racked my brain for hours trying to figure out why my app couldn’t be verified. It turned out that I had different code signing settings on my project and target. Once I set them to be the same everything worked great.

  5. Hello Lajos,

    All your guidance has saved me hours of research. Thank you.

    I got past my initial cert config, now that I have a successful build, I get the following when I try to deploy the app to my iPhone …. any idea why? Thank you.

    Your mobile device has encountered an unexpected error (0xE800003A)
    ApplicationVerificationFailed

  6. @Jacob: 0xE800003A means that your phones doesn’t have the .mobileprovision file installed that you signed your app with.
    You can install it in the Organizer.

  7. My problem is no matter what I do, I always end up with

    ProcessingProductPackaging adding .xcent instead of embedded.mobilProvision

    and

    CodeSign is properly doing /usr/bin/codesign -f -s “iPhone Distribution: ”

    I have distributed this app to the app store already once before, and I had to just try everything and eventually I got it to work, no clue how. Now I am making a change and I cannot get it signed correctly.

    Apple, please fix this!!

    Thanks for the help lajos!

  8. @Matt: I’ve had a similar problem in the past, what helped was duplicating the target and deleting the old one. I would also try reinstalling xcode. Hope this helps.

  9. Hello,
    thanks for all this. I went through this hell once and by tinkering had it working. Then the other day I download AppSales from google code and can’t get it to work on my device (either by using ad hoc or development profiles) turned out it was the project setting (which shouldn’t matter if target is set) which didn’t agree with target and was messing everything up.

    By the way you write:
    3. code signing uses the correct identity

    On a side note, I suggest installing the provisioning profiles by manually copying them into the {YOUR_HOME_DIRECTORY}/Library/Mobile Provisions folder rather than dropping them on xcode because when dropped on xcode the files are renamed to their ids. If you copy them by hand the file name will remain consistent with the build settings and the build output. (You can open up the certificates and look at the ids by the way, but why bother with remembering hex values at 3 in the morning.)

    Another easier way is to drag on itunes icon in teh dock. It doesn’t rename the profile either

  10. My problem is that in keychain access it showing the public and private key when i select all items in category but it does not show triangle left to the certificate and that’s why not showing the private key associated with it.
    Please reply. Any help will be appreciated.

  11. Pl;ease make sure that you have the “Certificates” category selected in Keychain Access. By default it shows “All Items”, where you can’t see grouping (triangles.)

  12. @Matt: did you figure out a fix to your issue? I’m having the exact same problem with my distribution build. I tried the target duplication that lajos recommended but it still runs out the entitlements. I’ve removed all entitlement entries in my build and project. If anyone has any suggestions I would love to hear them.

    And while I’m at it — this problem is referring to my distribution build for the AppStore, but can someone clarify for me whether an Ad Hoc distribution should run the embedded.mobileprovision packaging? I assume it should run the entitlements instead, but I was having major problems with that build as well and I could find nothing to indicate whether the same verifying lines were expected in Ad Hoc successful builds.

  13. It should run the embedded.mobileprovision packaging.

  14. I repeatedly receive the error,”The binary you uploaded was invalid. The signature was invalid, or it was not signed with an Apple submission certificate.”. I’ve followed all of the advice above, except for the reinstallation of xCode.

    In my Build Results, I see two paragraphs that begin with “ProcessingProductPackaging”, and only one of these paragraphs shows the correct path to my distribution provisioning profile.

    What next??

  15. i had this exact same problem once… the fix was to duplicate the target, delete the original target and build with the new one. note that duplicating the target also creates a copy of Info.plist, you can fix this in build settings.

  16. I did this, but will try it again, as I may have missed a step.

    iTunes Connect tells me that there can be no spaces in the binary file’s name. What is the correct way to rename the binary? If I change “Rogers Game.app” to “RogersGame.app” after building, could that be causing my issues?

    Roger

  17. Nice article! Turns out I was missing the Worldwide Developer certificate. What a mess.

  18. [...] how to fix iphone code signing errors [...]

  19. The app builds fine and runs on my iPhone fine. When I try to build
    the Distribution app, it builds fine with no errors
    and the code sign -vv says the app is valid.
    BUT THE COMPRESSED zip file isn’t code-signed and is not valid???

    any ideas ?

  20. [...] Code Signingがうまくいかない場合はここをよく読んで対策を行うこと。 [...]

  21. Hi Lajos -

    THANK YOU VERY MUCH FOR THIS ARTICLE! I spent about ~8 hours trying to get my app’s binary submitted to the app store. For a while, I seriously considered another line of work - maybe a potato farmer.

    I’m new(ish) to Xcode and picking up Objective C was a whole lot easier than figuring out how to submit an app. Why would Apple make this process so difficult? I think installing an Oracle server is easier.

    I’m now an official fan of your blog and I appreciate your efforts in helping the development community.

  22. I am so happy I found this. My private keys were still in my keychain, but no longer associated with the certificates because of a previous attempt to fix a different problem: my default keychain was System instead of login. I followed some bad advice and tried to delete, then re-add the certificates. I should have exported them first!

    Well, I re-requested my certificates, re-downloaded and imported, etc. After setting my default keychain back to login, of course. Now all is well again.

  23. I also had an issue where my default keychain had been changed from the “login” one to the 1Password one I have. This was preventing me from building, giving an error that the identity I was trying to use could not be found in the default keychain.

    I went into Keychain Access and right clicked on my login keychain (the keychain with my dev certs installed in it) and said “make default” to fix the problem

  24. [...] how to fix iphone code signing errors [...]

  25. [...] How to fix iPhone code signing errors [...]

  26. Hello Lajos
    Many thanks for your excellent article ~ you have got me out of a very frustrating mess.

  27. [...] Cocos2d-iPhone Collection of various links Homepage Google group API reference Notes on Cocos2d iPhone Development Move sprite example Introduction to Cocos2d iPhone Monocles Studio Intro Collision particle Great site with lots of simple examples Game walkthrough Sapus Tongue Sources Coloring Sprites Bounching ball 2 Permadi Splash screen Xcode signing errors [...]

  28. I love you for writing this. LOVE.

  29. Lajos,

    There is a problem with code signing not covered yet by your great tutorial. Namely, the:

    CSSM_SignData returned: 80011009
    unknown error -2070=fffff7ea

    message problem. Let me describe my symptoms and solution, history will be slightly long ;)

    At start, when I had no iPhone developer registration yet, I’ve noticed that my XCode is not able to remember SVN password in SCM configuration. I thought that this is some problem with keychain, but was not able to figure what it is. However, Keychain aid said to me, that keychain search list is not correct. I ignored that problem and went away without stored password.

    When I finally got my iPhone dev registration, I went through assistant, generated all certificates, imported, all ok. When I hit ‘build’ button for first time, there was a prompt if I want to allow codesign to access my keychain, I pressed ‘Allow always’. And build failed. And failed again. But XCode always prompted me if I want to allow codesign. I’ve checked all settings, certificates, google, nothing. Then, accidentally I’ve noticed that when I press ‘Allow’ instead - and wow, it worked! Pressed ‘allow always’ again, failed. So, the problem was not with certificates, it was with keychain!
    So, I started to dig XCode+keychain issue. I have noticed that many people have ‘login’ keychain, while I had only ‘System’ one. When I took a look into ~/Libraries/Keychains, login.keychain was there, but still Keychain Access didnt see it. So, I opened that keychain with Keychain Access. It was not working, until I also done following:
    - make login keychain default (File->Make default)
    - fix the keychain search path (through Aid -> Repair)
    - Moved all certificated from System to login.

    For some reason I was not able to export my private key, it kept endlessly asking me for a password. So I bite the bullet, deleted it, recreated all keys and certificates again, imported them to login. Now my XCode is able to store all passwords (including those from SVN), and no problems with signing.

  30. Thanks for writing this - I’ve been fighting this code signing thing for a couple of weeks, and nothing worked, until I read this page.

    Kudos!

  31. Thanks for this page. I finally found my solution today, and it wasn’t listed here so I thought I’d share:

    I was getting a code signing error when I tried to upload on iTunes connect. It looks like, to test this, you can run codesign -vvvv MyApp.app to verify if your app was signed. This was always telling me that my app was signed correctly. However, I downloaded ApplicationLoader and tried with it. It actually gives much better error messages than iTunesConnect (you have to go to the OSX Console to view it).

    Based on that, I was able to track down that, even though my .app was signed just fine, when I compressed it, not everything was being added, so that when it was decompressed to check the signature, it was missing files. (It turns out that the recommended “compress” in finder does not include filenames that start with underscore (_), like some ofthe buttons in facebook connect are). To solve this, I zipped the app dir by hand, and then it worked like a charm. (Note that, getting zip on the command line to handle things correctly was also not easy, since there is a symlink in the App dir that it needed to preserve). I ended up having to ‘compress’ in finder and then add the missing files by hand to that zip archive.

    Summary: if you’re having problems, unzip the .zip file you’re trying to upload and run codesign -vvvv on it to see if it is still valid.

  32. Lajos,

    Thanks for this page… finally got this problem solved!

    Jay

  33. Hey-Thank you very much. You have saved my lot of time. Solution#4 fixed my problem :) God bless you dear.

  34. Hi,
    Just wanted to let you know that your article helped me out quite a bit tonight. Our project had managed to get into the state where the Code Signing Identity and Provisioning Profile were set different between Project and Target.

    Thanks - and keep up the good writing style - letting people know they are not the only ones with crazy code signing problems up front helps :)

    Michael

  35. Thank you for your help.

    Everything worked fine except that I have to drag the certificate in Keychain Access. (click did not import the certificate )

  36. [...] checked a bunch of things from my old post about code signing, but I could not fix the [...]

  37. Great article. I had the same problem but suddenly it worked for no apparent reason. Probably hit the right key at the right moment. How much do you charge for the cake and the sausage?

  38. Hey Lajos,

    I’ve had a problem with the distribution of my app on AdHoc mode. I’ve been battling with code signing for a year now (since I got my dev license basically), but never encountered the problem below. I’m writing you cause I practically don’t have any more hair on my head, and people are getting worried ;)

    I’ve got the right certificates on my keychain and the Distribution certificate is linked to my private key. Check

    I’ve created a Distribution provisoning profile for my app using the generic app Id, all the devices I want to send the app to and obviously it uses the only possible distribution certificate there is. Check

    I’ve started xCode and checked the project/target build info. There I got discrepancy on one of the code signing lines. Corrected.

    I’ve checked at the build results to see if it was using the right profile. It wasn’t, although I specifically sign with my distribution profile, for a weird reason, xCode takes an old development profile to sign my app… Thanks but no thanks. Corrected

    After all those corrections, I’ve removed all mobileprovision files and imported the profile I created above. just to make sure there could be no way xCode could mess up again with profiles. Check

    Closed up xCode, removed build folder of my app, open xCode again, build my code using the distribution settings. App got created in the build folder under distribution and the build results looks perfect. Check

    Got the provisionning profile that help sign the code, and the app file. Drag them up into iTunes and try importing the app on the test iPhone. ERROR ERROR, at the end of the sync, when it downloaded the app into my iPhone, it gives me the strangest message, saying that this particular iPhone does not have the right privileges to get that app. WTH??

    I’ve got to say, before the code signing was messed up because of xCode’s way of messing up the profiles and uploading the app gave me an error message saying that the code signing wasn’t valid. but this time, the error message changed and it makes no sense. The profile is “obviously” set up to include that iPhone UDID.

    If you’ve got THE idea to solve that one out, I’ll be eternally glad.

    Thanks,
    Stephane

  39. I am a complete newbie to this mac, xcode or whatever.

    i bought mac mini, downloaded the iphone sdk 221 and it went alright. i was playing around with it for quite sometime.

    then snow leaopard came in. i formatted my HD and installed Snow Leopard and installed SDK 31 that includes i think Xcode 32.
    now i cant run any app in the simulator neigther new ones nor previous ones.
    i just dont have clue. is this code signing they introduced in SDK 31 or what cos i never did anything on SDK221 and everything was working. i could build a blank app and run it the simulator. now only error.

    please need help.

  40. @Akbar: I don’t think it’s code signing related. Did you install the correct sdk (for Snow Leopard)? You should send more info… what error are you getting?

  41. Hi

    I have exactly the same pb than Stephane…

    Any clue someone ?

  42. @Ol & Stephane: Make sure that you have created a code signing entitlement in your project, unchecked the get-task-allow option in the entitlement and that the entitlement is specified in the Distribution build settings. That is the most common problem with adhoc distribution. If itstill doesn’t work, feel free to contact me, I can help you fix it.

  43. Te, hogy én mit szívtam ezzel…
    A keveredés fő oka, hogy mivel különböző fejlesztői team-eknek is a tagja a devaccom és mindegyikhez másik developer identity certificate jár, plusz a team agen helyett is nekem kell forgatnom distribution célzattal az appokat, ezért van már vagy 5 developer certificate a keychain-emben és úgy egy tucat provisioning profile a gépen. Teljes a káosz!
    Azért sokat segített a sanity check listád, szal köszi.

  44. Can’t tell you how much time this would have saved me if i’d have found it earlier ;o))
    Still saved me a lot of time as i hadn’t sorted the issues.

    Ad-Hoc seems a bit of a nightmare, have tried for hours to get a couple of very simple apps over to some friends to try out and its just not having it.

    Did anyone find out how to do this?
    Thanks

  45. @Chunks: Make sure that you have an entitlement in your project, you unchecked get-task-allow in the entitlement and specified the entitlement in the build settings.

  46. you need non-wildcard app ids for push notification and in-app purchase.

  47. Hey thanks for this article, should have found it earlier.

    I have the same problem that Bungler and Jonathan mentioned at the very beginning. The build wents fine, but I don’t see any output which verifies the code signing.

    Thanks

  48. Thanks a lot for this post! Great. Best wishes, Max

  49. I’m having an issue with my test user now being able to install my app: he said he received this error message: application signature was invalid.

    I’ve verified in the build log and in the .app directory that the correct provision profile was included in the .app, I have the Entitlements.plist file with the box unchecked, and that it’s being installed in the distribution directory. I have different project and target settings but verified that the code signing in the distribution build log is the distribution certificate. I get no build errors. When I delete my app from my iPhone, and reinstall via itunes just like a user would do, it works perfectly and runs.

    The one thing that I didn’t do from the directions here was to download the WWDC certificate. What does this do? How does it change anything? If I was able to install the test app on my device through itunes, doesn’t that mean that it should work for my user, too? The provisioning profile contains the user’s UDID.

    Any help is appreciated!

  50. oops! I meant: *not being able to install my app

  51. @Bogatyr: Make sure that your test user installed the .mobileprovision file on hos phone. He can check that on the phone in Settings / General / Profiles. He does not need the WWDC certificate, but you need that installed on the computer where you are making the build.

  52. I’m having a particularly peculiar case. I am doing an Ad Hoc distribution, and have successfully built and installed our app on multiple phones using an add hoc mobileprovision file and a distribution build built with it. Everything works fine.. until we get the the VP’s iPhone. When he attempts to install the app via sync to iTunes he gets “the application signature is not valid” message.

    With all previous users i modified my mobileprovision to add new devices but was able to send the modified mobileprovision along with the original app build and the users are able to install successfully.

    With our VP, i haven’t been successful even after rebuilding the app using the modified mobileprovision containing their device ID.

    Their iPhone is from France. Does this perhaps have anything to do with the issue I am facing? I am at a loss so far as it installs successfully on 4 other iphones synced from both PCs and Macs.

  53. @ch-apps: That sounds weird. I can only think of two things: the persone didn’t give you the correct ID, or he’s not installing the certificate correctly. Ask him to make sure that the profile shows up in his device in Settings / General / Profiles. Maybe you can even ask him to delete the profile in the same menu and reinstall it.

  54. New to Mac. Learning C, Objective C and iPhone Development all at once. First iPhone app development going well, simulator trials running well. All of sudden a build results in the message that got me to these posts: Code Sign error: The identity: ‘iPhone Developer’ doesn’t match any valid certificate/private key pair in the default keychain. I don’t mind doing some hard work but any clues ehre to start? What did I do wrong. Never did anything but change .h and .m files using XCode and IB. Any help much appreciated. JS

  55. @John: You need to create a developer certificate and install it on your keychain. Go to developer.apple.com/iphone, login and click on the iPhone provisioning portal on the right. You will also need to install the wwdc certificate, but there are instructions for that on that page. I assume you already paid the $99 (otherwise you can’t do this).

  56. Thanks so much for these pointers. Wasn’t seeing either the productpackaging line nor the codesigning. Tried setting project and target profiles to match and still same. Reinstalled iphone SDK still same. Went into target info and deleted the line for the provision profile and all works now.

  57. Actually it seems the previous problems I had weren’t due to the profile mismatches. I was previously building with the iPhone simulator selected as the device instead of the physical iPhone device. All sorted now.

  58. I just wanted to thank you for the advice. Exercise 3 solved a major headache for us today.

  59. Hi Lajos,

    I’ve just spent a day and a night tearing my hair out trying to get AdHoc distribution working for our beta testers.

    I came across this excellent post and would like to take you up on the offer of help.

    The error I’m getting when users try to install the ad hoc app is :

    “The application XXX was not installed on the iPod yyy because it is not compatible with this iPod”

    I have been through all the steps in your post - search every google result I can think off. I even started with a brand new project that just does a “Hello Would” and went through the whole process again - still with the same result!

    App builds fine - the correct provisioning profile is being used in build results. The mobile provision is installed on the device and everything works in debug and release modes.

    I’m really stuck now and not sure where to go next.

    Any help, ideas or pointers would be most gratefully received!

    Many thanks

    Matt

  60. @Matt: Are you sure this is a code signing error? Do your users have the same version (or newer) iphone os you are building for?

  61. Thanks for getting back to me. I think I finally resolved the problem about 10 mins ago - I’m just waiting on feedback from beta testers now.

    I think I tracked the problem down to an entry in the Info.plist. The weird thing was that this only occurred when trying to do an Ad Hoc distribution, hence my suspicion that it was a code signing problem.

    In the end I deleted all the certificates, device IDs and provisioning profiles from the portal, my Mac and iPod and started again from scratch. Your post was invaluable here in both guiding the process and helping me overcome the fear of permanently breaking something!

    I also cleared out my Keychain, uninstalled XCode and downloaded the latest version of the SDK and XCode.

    Somewhere along the line this gave me a much better error report when building that pointed to the “UIRequiredDeviceCapabilities” entry in the info.plist. Although I cleared all the options (no need for camera, accel, etc) it still gave me compatibility problems. In the end I deleted the whole key “UIRequiredDeviceCapabilities” and the problem disappeared.

    Thanks again for the help and all the best.

  62. help

    Code Sign error It’s Not Working show me 1 failed

    Code Sign error: The identity ‘iPhone Distribution’ doesn’t match any valid certificate/private key pair in the default keychain

    i build app before no problem I don’t know wats wrong with my keychain
    I have both the Development and Distribution certificates in my keychain and they are both valid

    i change leopard to snow leopard

  63. When I bought my ipad I registered it with my personal itunes account. Then I joined the developer program and used a different account.
    I am trying to deploy my app to my ipad but I am getting an error in Xcode saying that it can’t find a valid certificate for the profile. I have followed all the steps of generating a cert on the keychain, submitted it to the apple website, and then downloaded the cert, created a provisioning profile and downloaded it.
    My only guess is that my ipad was registered with a different account than the one I am generating the certs/profiles with. Could this an issue? Should I reset my ipad and register it with my developer account?

  64. @Brandon: No, that should be no issue. You can have the iDevice registered to another iTunes account. Most likely you have an issue with your certificate. Make sure that in keychain under my certificates there is a triangle to the right of your developer certificate. When you click the triangle to expand it, you should see your developer key… if not (which most likely is the case) your certificate doesn’t match any keys on your keyring. Delete it and go through the certificate request again. Just make sure to update your provisions after you get the new certificate.

  65. @Mato: You lost your old keys. There is some info on the program portal on exporting your keys, however it’s too late for you ;( Just delete your certificates in keychain, request new ones, update your provisions with the new keys and you should be back in business.

  66. I submitted a binary a week ago after following Apple’s instructions for code signing. Now, I can run my app on the simulator but not on my device. In the project settings, I have set the profile to Development, not Distribution. Yet when I try to build and install it, it asks if it should install my distribution profile on my phone (which it obviously cannot do anyway). I deleted my distribution profile out of the organizer and now it won’t even build, claiming the provisioning profile can’t be found (fortunately it will still run in the simulator). I duplicated and cleaned and restarted; I haven’t found how to edit Target settings, just Project ones.

  67. Thank You!! Saved me so much time. — Needed the private keys.

  68. You absolutely rock for posting this here. Even though I’ve gone through this process a dozen times or so, using 5-6 different developer accounts, it’s amazing how many times you “just forget” that one step that makes the app refuse to board the device. Finding this page saved me hours tonight.

    You’d think I’d have written all this down myself at some point, but usually, by the time one gets the app provisioned, it’s impossible to remember to write it down. Thanks again!

  69. I absolutely HATE I mean really HATE this code signing BS!!!! It’ more confusing then making an app!! I could install my app to the iPhone just fine two days ago, today out of the blue it gave the code sign error, this isn’t the first time it happens, in the passed, I just went through the painful process to get a new profile then it worked, but not today. I spent a good four hours tried to get a new profile to no avail. This is so BS from Apple. For this I can strangle!!! who ever idoit at Apple came up with this crappy idea!!!

  70. just want to get it out of my chest. whoever created this code sing process, was he/she once a Mcrosoft engineer? he/she should be shot!!!

  71. [...] How to fix iPhone Signing Errors: http://www.codza.com/how-to-fix-iphone-code-signing-errors [...]

  72. It is 4:30AM here in Texas and you have just saved my life! I have been trying to figure this out all day. As it turns out, my distribution provisioning profile was not saved in the correct folder. That solved everything.

    Thank you so much!

  73. I had the same problem,
    I’ve resolved by deleting the Distribution Profile file (.mobileprovision) from {user}/Library/MobileDevice/Provisioning Profiles/ and just copy it directly in this folder.
    It seams that installing the Provisioning Profile by dropping it on xCode Icon is causing the issue (maybe because renaming).

  74. Eventually, with xCode 3.2.3, the whole took me fifteen minutes BUT only after an entire DAY of struggling - mainly because I had no idea what I was doing.

    Thanks to your explanations above, I now understand something about the WHOLE process and also about the various pieces in xCode - so I was able to ignore those parts of the current Apple-instructions that still refer to older versions of xCode.

    Many, Many thanks!

Leave a Reply