Bypassing the Trouble Caused by Updating an iPhone App Provisioning Profile
[UPDATE] After many discussions on Twitter and many recommendations by different folks, I think that we have determined that the method outlined below is not necessary. Mike Taylor has hit upon what appears to be a foolproof method for getting around the trouble caused by updating an iPhone app provisioning profile, and best of all, he did it in 140 characters:
@kalperin @MrRooni Delete old profile from Organizer. Download new profile ‘n drag to organizer. Restart Xcode. Choose new profile in target
Many thanks to Mike for helping me out here, I owe you a beer at WWDC10. For those of you interested in the more masochistic way to get around the issues, feel free to continue reading:
A note before I begin: Everything below was done with the final build of the iPhone OS 3.0 SDK and I was building an app using the 2.2.1 frameworks.
I recently acquired a new iPod touch to use a development device. One of the first things that I wanted to do was get my existing project up and running on the device so I headed over to the iPhone Development Program Portal to update my provisioning profile.
After adding the new device to my app’s provisioning profile I downloaded the updated profile and installed it into Xcode and onto the device via the Organizer. So far so good, everything up until this point worked exactly as I expected it to.
Switching back to my project I changed my build settings to be a Release build under 2.2.1 on the device. The app built fine, but I got an error when it tried to install the app onto the device, something error akin to “This device doesn’t contain the provisioning profile with which this app was built”. Thinking that maybe Xcode just hadn’t seen the new profile yet I cleaned all targets in my project, restarted Xcode and tried again. No dice, same error as before.
I then proceeded to delete all versions of the profile from the organizer and re-installed the new one. My assumption was that once Xcode saw that the old profile didn’t exists anymore it would switch over and use the new one. I cleaned all targets and built again. This time I was treated to a different error: ”Code Sign error: Provisioning profile ’3E6AA725-6534-46F8-B9CE-D19AC9FD854B’ can’t be found”
After a bit of Googling I discovered that Xcode stores the ID of the provisioning profile in its project.pbxproj file. This discovery led me to the fix:
- Close your Xcode project
- Navigate to your project folder in the Finder
- Right click on your .xcodeproj file and ‘Show Package Contents’
- Drag the project.pbxproj file to Xcode (or any plain text editor)
- Perform a search for the term ‘provision’ to find the PROVISIONING_PROFILE entry.
- Copy the existing profile ID and paste it into the find field of a find and a replace dialog.
- Open up the Organizer window (Window menu > Organizer) and navigate to your new profile under IPHONE DEVELOPMENT > Provisioning Profiles
- Click on your provisioning profile and copy its Profile Identifier
- Paste the string into the replace field in your open find and replace dialog.
- Replace all instances of the identifier, save the file, close it, and reopen your Xcode project.
- That should do it, build and go to run your app on your new device.
Now there is a great possibility that I am going WAY overboard here and missing a very obvious way to accomplish the same solution. If that’s the case please let me know in the comments.
| This entry was posted by Michael on June 19, 2009 at 12:45 PM, and is filed under Cocoa, Debugging. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |

about 1 year ago
Do a ‘Get Info’ on the root of your project in the “Groups & Files” view. There should be a “Code Signing Identity” setting. All you should have to do is set that to the correct provisioning profile. I do it for all configurations and that is it.
about 1 year ago
I’ve found provisioning profiles to be finicky. You have to install them in two places (both in the organizer, IIRC) and then sync with iTunes, and occasionally reboot the device as well.
about 12 months ago
@Mark (#1 comment):
Your solution does not always work. It’s the way you’re SUPPOSED to do it, but if you’ve created projects from previous projects, you might have several entries in the project.pbxproj file XCBuildConfiguration section with the same name. This problem might be an artifact of the fact that I name all my provisioning profiles with the same suffix (x DEBUG, x RELEASE, x AD HOC, and x APP STORE) for builds that I want to put on the device for organizational sanity.
Thus I have to go through similar hoops that are specified above. However, I’ve found that the simpler way is to:
1. close xCode
2. delete the PROVISIONING_PROFILE lines in the project.pbxproj file
3. open the project in Xcode
4. specify the build and click the Info button to re-specify the code signing identy–I’ve got multiple provisioning profiles running around, so I need to do this.
I’ve tried the replacement method, and I inevitably mess it up. And I don’t like the updated method either.
thanks, Chuck
about 12 months ago
Just to be safe, between steps 1 and 2 of my description above, it’s wise to make a copy of the project.pbxproj file before editing it!
about 11 months ago
I’m trying to get some help in regards to a demo software I was sent.
I have the provision file and the app. where do i install these 2 files?
I can’t get this app to install on my phone..please help.
about 11 months ago
Rick,
You can drag those two files to the Applications section in iTunes and then sync your phone. The app should be installed then.
about 11 months ago
so i put the .provision file int he same folder with the .ipa files? that would be the only odd ball in there.
I tried that, but the app still isn’t syncing to my phone
about 11 months ago
Rick, check out this link for step by step instructions: http://www.innerfence.com/howto/install-iphone-application-ad-hoc-distribution
about 10 months ago
I was also having this problem and I had the PROVISIONING_PROFILE duplicated in project.pbxproj. I found the easiest method was just to delete the existing configuration I had called “Release Ad-Hoc” and then recreate it. This was easier than manually editing the project.pbxproj.