iPhone SDK – CodeSign error: a valid provisioning profile is required for product type ‘Application’ in SDK ‘Device – iPhone OS 2.2

This is more of a ‘note to self’ than anything else, but if you’re developing for iPhone it may save you some searching…

As part of the Uggles gameplay testing process we had a requirement to add ‘multiple’ new devices to our provisioning profile. This process is well documented by Apple and is generally pretty straight forward. The end result is that you have a new provisioning profile with your new devices embedded and it’s a simple download and drag/drop onto xcode to install them, well not quite!

When attempting to build with our new provisioning profile, we failed with the following error :

‘CodeSign error: a valid provisioning profile is required for product type ‘Application’ in SDK ‘Device – iPhone OS 2.2′

*Your SDK version may vary.

But we just installed our new provisioning profile right, it seems not, in our case XCODE was not recognizing our new profile and attempting to build with the original profile (which does not know about our new devices/handsets).

After some initial hunting it seems you must get your hands dirty and edit your projects .pbxproj file.

Make sure you’ve backed up your project before attempting any of the below:-

#1 Go to ~/Library/MobileDevices/Provisioning Profiles, there you should be able locate your ‘new’ profile (we simply used the date in Finder, but you might have to using something like grep to find your new device UUID(s)).
#2 Copy the xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx number from the profile filename.
#3 Go to projectDirectory/ProjectName.xcodeproj/ (use show package contents).
#4 Open project.pbxproj and search for all instances of PROVISIONING_PROFILE[sdk=iphoneos*] replacing the assignment value with the number you copied in step #2 (only do this for your debug and release configs. if you have a distribution profile).
#5 Rebuild your project, and hopefully the CodeSign error is no more!

Can’t guarantee this will fix all cases, but it certainly worked for us. You can find further information here .

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • De.lirio.us
  • Live
  • MySpace
  • Slashdot
  • StumbleUpon
  • N4G
  • Technorati

19 Comments to “iPhone SDK – CodeSign error: a valid provisioning profile is required for product type ‘Application’ in SDK ‘Device – iPhone OS 2.2”

  1. Thomas G. 13 March 2009 at 10:50 am #

    Wow, just right in time!
    I was nearly getting insane with that problem and luckily found your post.
    Thank´s a lot.
    Thomas

  2. Liviu 17 March 2009 at 6:39 am #

    Thanks a bundle for this post – I would’ve had a lot more trouble without it.

    Lousy flaky Apple systems…

  3. Chris 1 April 2009 at 8:53 am #

    This was just what I needed – thanks so much!

  4. pbernery 14 April 2009 at 3:49 pm #

    You can also do that in XCode build settings. Double click your project icon in XCode, go to Build and search for Code Signing Identity. Here you can update the provisioning profile to use. You’ll see that XCode is still trying the old one, but you can update to the new one easily.

    • Antonio 23 April 2009 at 4:13 pm #

      Hi pbernery,

      I don’t agree with you. I think there must be a bug with that updating method…

      At least I couldn’t make it work…

      Bye

    • Peter 22 May 2009 at 10:52 pm #

      Hi pbernery,

      I also don’t agree with you. This issue is when the normal workflow fails for some reason. Selecting the provisioning profile within xcode stopped working (for some unknown reason). Manually editing does work.

      But yes, normal workflow, just select the correct provisioning profile. If you get this error and everything looks right, then as this article says, check the numbers in the pbxproj file… if they DO NOT MATCH, then this is likely the problem… make them match by manually editing the file… viola…

      Peter

    • Kaming Li 8 June 2009 at 6:00 am #

      These steps worked for me:
      1. I created a new provisioning profile that uses a wild card, instead of one that uses a specific application name.
      2. Deleted all the old provisioning profiles from the Organizer in Xcode.
      3. Downloaded the newly created provisioning profile, and then drag-and-dropped into the XCode icon. This would install the new profile.
      4. In the Organizer, select your device and click + in the provisioning section.
      5. In the “Target ‘YourAppName’ Info” dialogue window, look for the Code Signing Identity – Any iPhone OS Device, use the dropdown to select the proper certificate (I noticed mine was set to one that had a previous app id, so re-selecting the proper certificate cleared the old one)
      6. Clicked Build and Go and my app installed on the phone. :)

  5. Dan 18 April 2009 at 9:03 pm #

    Thanks man – saved me a lot of trouble. I was trying to update to my new distribution profile (as the old one had expired) and XCode just wouldn’t use the new profile (even though in the build section of the project info it said it was)!!

    Anyway, in my case it had the new profiles ID listed in the first distribution section and then had the old expired one listed in the 2nd distribution section. Deleting the line : “PROVISIONING_PROFILE[sdk=iphoneos*] – XXXXX-xxxx-xxxxx” in the 2nd distribution section (but leaving the rest of the section intact) solved my issue and XCode would now build and iTunes Connect now accepts the new distribution. Thanks again!

  6. Antonio 23 April 2009 at 4:09 pm #

    Thanks a lot, I’ve been more than one hour editing the provisioning file, downloading it, and installing and unistalling it from XCode…

    Finally I found your post.

    Thanks Million

  7. Mac 14 May 2009 at 9:11 pm #

    Thank you, this saved me a lot of trouble too!

  8. Rob Griffis 14 May 2009 at 10:38 pm #

    Thank you. I got Wolfenstein full source to compile and
    downloaded by using this technique. I used my major
    provisioning file’s number and edited the Wolfenstein project file. Super. Thanks.

    I did try using XCODE to change the provisioning but it didn’t save it properly or something.

  9. Neal K 10 November 2009 at 11:50 am #

    Big Thanks.
    I’d wasted two hours trying to get this working before I found your page.

  10. Luca 29 November 2009 at 12:15 pm #

    Hi, it worked for me too! Thanks a lot!

  11. Richard R 3 December 2009 at 8:12 am #

    I paid a developer to make an application for me. He didnt offer any support after delivering the xcode project. Being a newb I didn’t know much about what to do to submit an app. Using your method I found he had all his code signs in the app, along with that he had his name as the copyright and had a different admob identifier number than the one I supplied him with. You saved me sooooo much money! I won’t get the last 6 hours of my life back that I’ve spent cussing and pulling my hair out. But you sure made it shorter.

    I can’t thank you enough for your help. We will see what happens with the approval process!

  12. adana oto kiralama 9 January 2010 at 11:28 pm #

    Hello, perfcet web site. Thank you.

  13. Simo 12 January 2010 at 7:51 am #

    Fastest method:
    - Delete existing provisioning profile
    - Import the new provisioning profile (drag to Xcode->Organizer->Provisioning Profiles)
    - Go to Build Settings, Code Signing Identify. Lets assume you have there “iPhone Distribution: YourCompany”. So this is the provisioning that has changed but is not updated correctly.
    - Change it to “iPhone Distribution: YourName” (or some other extra provisioning you have.) Compile. Change back to “iPhone Distribution: YourCompany”. It works!

  14. best 19 January 2010 at 8:51 am #

    Now you can unlock your iphone and you can use it on any network worldwide , easy to use software , unlock your iphone in 5 minutes , visit us on bestunlockiphone.com

  15. Daniel Wood 21 January 2010 at 8:49 pm #

    I just ran into this. However, I got round it by changing my profile on my target and not just the project. This is where the old profile was lingering. Hope this saves people the hassle of messing with their project files.

    Daniel @runloop

  16. [...] http://www.frogameleon.com/blog/iphone-sdk-codesign-error-a-valid-provisioning-profile-is-required-f... [...]


Leave a Reply