1 Jan 2009

I just spent way too long trying to get my iPhone app transferred to my phone for testing.

To Apple's credit, their web site is very logically laid out and takes you through the numerous hoops you have to jump through quite well. Unfortunately, after setting up my team, creating my certificates, registering my device, setting up an App ID (hint: use * for your Development Provisioning Profile so that you can use any bundle identifier with it), downloading my provisioning profile and, finally, installing it XCode and syncing it to my iPhone, I got the following error while trying to build and deploy to my iPhone:

CodeSign error: a valid provisioning profile is required for product type 'Application' in SDK 'Device - iPhone OS 2.2'

I then proceeded to twiddle with everything I could possibly think of and started Googling like a mad man and twiddling with things that the pages I found told me to twiddle with. Unfortunately, of this twiddling produced any results.

In the end, what fixed it was restarting Xcode.

I only tried it after reading a comment on this post. Mr "v", whomever, you are, thank you!

After restarting, my build completed successfully, but, this time, it wouldn't deploy to the phone. My new error was:

The the device doesn't have provisioning profile the application was signed with.

During my twiddling, I had created a second provisioning profile, deleted the first one, and transferred the second one to my phone. Even though the first provisioning profile did not exist either in the Organizer in XCode or on the phone, I was getting this error. Thinking that a similar sort of caching must be at play, I proceeded to do the following:

  1. Delete both the provisioning profiles under ~/Library/MobileDevice/Provisioning Profiles (interestingly, they were both there, even though I had removed the other one from the organizer in XCode)
  2. Restart XCode

And that did it. To tell you the truth, I don't even know if Step 1 was necessary. It may just be that XCode was caching something and the restart did the trick yet again.

So, all this to say, if you're in iPhone Provisioning Hell, you may want to try restarting XCode first, before pulling out your hair.

Add Your Comment

Spam Protection by WP-SpamFree

Apple iPhone Provisioning Hell: have you tried restarting XCode?

  1. I’ve gone through the exact same problems last week. It’s a very tedious process to get everything up and running like you want. The certification is something I can handle, the 1 day valid ad-hoc provisioning profiles that make Xcode behave badly are a disaster. The Apple documentation is ok if you’re walking the same path they have in mind. But once you want to do things a big differently everything tends to get messed up and you’re left with googling for a solution based on vague error messages.

    Thomas
  2. Just wait until you start trying to do a release build. For some reason – unkown to all but the development folks @ apple – xcode doesnt seem to like running a provisioning profile alongside a deployment profile. To release either a ad-hoc distribution build OR a app store deployment build you need to delete ALL existing provisioning profiles from your library.

    Far from ideal and a real head-fuck !

    pete
  3. Thanks a lot. It helped me a lot.

    Kiran
  4. Thanks!!!!!

    Matteo
  5. Every friggn time Apple releases a new SDK I run through this same problem or some hellish incarnation of it, all the way back to the original SDK beta 3. Sheesh.

    Sam
  6. thanks man, actually step 1 that you said was probably not required, was actually required :)
    You saved me a couple of hours and quite the headache, thanks !!

    Jojo
  7. I ran into this error while trying to install my app on a 2nd device (on a new provisioning profile)

    “The the device doesn’t have provisioning profile the application was signed with.”

    Switching to “Debug” got the app installed on my 2nd device. Not sure what the difference is there, but I can live with Debug for now.

    Cheers

    Kris
  8. Hey, that actually worked for me. Thanks for the tips, I think they cut down on my own provisioning hell by several hours.

    Donald Bellenger
  9. Similar problem & fix:

    Installed the 3.0 SDK and XCode, and updated devices to 3.0.

    When trying to deploy debug version to device, get error:

    Can’t run “x” on the iPod “y”. The iPod “y” doesn’t have the provisioning profile with which the application was signed. Please add the provisioning profile via the Organizer or check the “Code Signing Identity” build setting.

    Checked device has profile (both on the device under Settings->General and via the Organizer). Double checked using the right signing identity. Tried cleaning everything, emptying the XCode cache, rebooting both the Mac and the device.

    Even deleted all certificates, etc and created brand new ones via the developer portal, and still getting the same error. Checked the certificates work fine in keychain, have the right default, have a private key, etc. Also checked the profiles have all the right app id’s, certificates, devices.

    Created a brand new “Hello World” project, set it up and — it worked! So that means it is something wrong inside the old project (i.e. all the certificates and profiles are working).

    Needed some manual editing of the project file. First of all make a backup (copy) of the xcodeproj file. This is actually a package, so Control-click and select “Show Package Contents”. Then Control-click on project.pbxproj and open with TextEdit.

    In the XCBuildConfiguration section had several lines with PROVISIONING_PROFILE that were not in the test application, as well as several CODE_SIGN_IDENTITY and one CODE_SIGN_ENTITLEMENTS.

    Remove all entries of these three types, save and close the files. Open the project in XCode and check that running in the simulator still works. (The device won’t work because we deleted all the signing).

    Select the Project root and click Info, then set the Code Signing Identity to the value you want, or you can select the Target and set the signing identity there. Anyway, after removing all the bad entries from the project file manually, deploying to the device is working once again!

    Sly Gryphon
  10. Sly, your suggestion to fix up the project.pbxproj worked perfectly.

    thank you.

    Matt Wyman
  11. I know that this may sound quite foolish, but it was not explicitly mentioned here:

    In the Organizer go to Provisioning Profiles section under IPHONE DEVELOPMENT. Delete profiles here and add correct (new) profiles. Clean and build your project for sure. This may be a solution, when you modify existing profile (adding new device to the profile, for example).

    Worked for me ;)

    manicaesar
  12. Sly Gryphon, your solution worked perfectly. My app was working fine, then xcode crashed, I rebooted it and started getting this error – safe to say I was tearing my hair out. So props to you for this great fix :D

    Chris
  13. manicaesar, many thanks for great tips, it just saved me hours and it now works fine.

    Sab
  14. manicaesar – thanks. I was missing my ‘new’ provisioning profile in the organiser. Adding it like you said in your post above (post 12) worked a treat. My hair is now intact!! ;)

    Matt
  15. Thank you for your help. I would add one more thing. In the info.plist you must change the Bundle identifier to what you named it in the Developers Program Portal in the App Id section (example) com.AppCompany.yourAppName…I know that it is explained somewhere to change that, but with all the cussin’ and screamin’ and readin’ vague error messages I must have forgotten… and maybe someone else did too.

    HNW999
  16. [...] first blog post of the year (on January 1st, 2009) was apparently about Xcode, the IDE I spent the most time in in 2009 as I [...]

    Aral Balkan · 2009 retrospective
  17. Wow. That did it. Restarting X-Code. Thank you!

    Chris
  18. jeezes.

    thank you mr. v, thank you mr. balkan! :)

    Chris
  19. Hey mate, thanks!

    My provisioning profile had expired, and it renewed ok… but every time I built and uploaded to my device, XCode demanded a reinstall of the profile.

    As per your advice, did the old ‘turn it off – turn it on again’ on XCode, and it fixed the problem!

    Had I not found your site I may have been stuck on this for hours before stumbling across the solution, so THANKS! :)

    mike lock
  20. Thanks, this helped immensely.

    Jon
  21. thanks!… just restarting did it for me

    Jim
  22. Best free Capture Flash Video is an excellent Flash Video Capture which can assistant you detect, record and download flash video, online TV shows, live videos, streaming videos from YouTube, Google video, Yahoo video, PBS, ESPN, blogtv, Adobe TV, etc. We can enjoy flash video on iPod, iPhone, PSP, PS3

    Best free Capture Flash Video is an excellent Flash Video Capture which can assistant you detect, record and download flash video, online TV shows, live videos, streaming videos from YouTube, Google video, Yahoo video, PBS, ESPN, blogtv, Adobe TV, etc. We can enjoy flash video on iPod, iPhone, PSP, PS3

    http://www.captureflashvideo.com/capture-streaming-media.html

    http://www.captureflashvideo.com/capture-flash-video-mac.html

    capture flash video