My weekend work plans were simple.
- Update iphone sdk to 2.2
- Write some more functionality for my FitTimer app.
Unfortunately the second part of my plan was never started because updating the SDK took most of my Saturday and Sunday.
The official update was not very difficult but after I have installed SDK 2.2 and updated my test devices I no longer was able to install my apps. I have gotten this nasty CodeSign error:
"CodeSign error: a valid provisioning profile is required for product type 'Application' in SDK 'Device - iPhone OS 2.2"
I have done everything from adjusting project settings to regenerating certificates and provisioning profiles. I have not gotten much traction with any of my efforts. The solution came after I have found a post claiming there is a bug in SDK2.2 that causes for the project files to get corrupted.
So I have pulled out my trusty (MacVim) editor and opened up the: ProjectName.xcodeproj/project.pbxproj file and started snooping around.
I have found that I had multiple Build Configuration sections and my
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
entry had a different number then my installed provisioning profiles.
So here are the steps to get it working again:
- SAVE YOUR WORK JUST IN CASE THIS SOLUTION DOES NOT WORK FOR YOUR PROBLEM
- Save your old project file.
- Go to ~/Library/MobileDevices/Provisioning Profiles
- Figure out which profile is the one relating to your project. Sometimes the profiles are saved with UUID as the file name so you may have to run grep with your project’s name to figure out which one it is.
- Copy the xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx number.
- Save your current work and close XCode
- Go to
yourProjectDirectory/ProjectName.xcodeproj/and using a text editor (MacVim for me) open theproject.pbxprojfile - Find all
"PROVISIONING_PROFILE[sdk=iphoneos*]"entries and replace the assignment value with the number you have copied in step 4. - Save the project.pbxproj file
- Reopen Xcode and recompile your projects. The CodeSign error should be gone.
$ grep myAppName * Binary file xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.mobileprovision matches
I hope this helps and saves you a lot of time.
Good luck and if you have some time please check out my app: FitTimer
Updated: [important]
Please read Big3’s post https://devforums.apple.com/message/15497 and file bug report with apple. Send them your saved project file so they can figure out why XCode projects are getting corrupted.



November 24th, 2008 at 11:22 am
You are a LIFESAVER!
November 27th, 2008 at 10:34 am
Thanks for your post. I had the exact same problem. Manually editing the project file to add the right uuid for the provisioning profile in both distribution configurations did the trick.
December 3rd, 2008 at 2:08 pm
Yup. This was my fix.
December 12th, 2008 at 10:07 am
You are amazing. This saved my butt. What a bug…
December 22nd, 2008 at 11:24 am
I am having this exact problem and I was SOOOO hoping this was the answer to my prayers, but I don’t have a project.pbxproj file anywhere on my entire mac, other than at Developer/Examples/Kernel/IOKit/Audio/Templates/SamplePCIAudioDriver/SamplePCIAudioDriver.pbproj/project.pbxproj
Any ideas?
Kevin
December 22nd, 2008 at 11:43 am
Oh, nevermind, doi! I figured it out.
December 24th, 2008 at 5:12 pm
And thank you, it totally fixed my issue!
December 30th, 2008 at 2:21 am
yourProjectDirectory/ProjectName.xcodeprojis actually a directory. So if you are in a terminal you will be able to do cd ProjectName.xcodeproj. If you are accessing the project from Finder, you should right-click and select “Show Package Content” to view the content of that directory.January 14th, 2009 at 7:35 am
Many thanks! Had to dust off my vi skills but all went well thanks to your post!
January 25th, 2009 at 10:20 pm
Great fix. Thanks for sharing!
February 12th, 2009 at 8:09 pm
Thanks for this one!
This also worked for me:
- quit xcode
- remove (but don’t delete) all the provisions from ~/Library/MobileDevice/ProvisioningProfiles/
- open xcode
- quit xcode
- add all provisions back to ~/Library/MobileDevice/ProvisioningProfiles/
- open xcode
- open target build settings and reset the provisioning profile settings for all configurations
March 13th, 2009 at 4:18 am
Thank you for this. This was the solution I was looking for all day.
The only thing I did differently was instead of editing in the Terminal, I opened up the package and edited the file you specified with BBEdit.
After making just one ID number change my app finally built and loaded on my iPhone. And when I added the app store provisioning profile it built for that as well.
If there is anything I can ever do in return, please let me know!
doug
March 17th, 2009 at 4:31 am
Thanks a lot, I was so upset when I got this error, just because I copied my project to a different location to have 2 versions of the same code.
Thanks this helped me a lot
April 14th, 2009 at 1:34 pm
Thank you so much, worked for me.
May 14th, 2009 at 3:48 am
I cannot find the PROVISIONING_PROFILE in project.pbxproj for some reason. Do I need to initialize the project somehow else than how is described in Apple’s help: http://developer.apple.com/iphone/manage/provisioningprofiles/howto.action ?
I’m sure your solution would work for me if the PROV..-string would be there.
Actually I’m just trying to push one of the programming tutorials to my iPhone, but this CodeSign error is preventing me from doing this..
May 25th, 2009 at 9:51 am
You are right you need to create provisioning profile with apple before you can upload the apps to your phone.
My tutorial has been written for projects that are failing because of corruption in the Xcode project file.
June 13th, 2009 at 3:53 pm
Hey guys,
I really can’t find this directory, neither with finder, or terminal. Is there another way? If I received the project from another person, is there a possibility that this file is only on his computer and not in mine?
Thanks
July 14th, 2009 at 5:17 pm
Note !!!!!!!!
often a simpler solution is just that,
you have entered your ENTIRE APP ID,
rather than ONLY the “bundle identifier”,
in Edit Active Target Settings, click “Properties”
Example, you should enter com.company.gamename,
NOT, 2fd3f2d3fd22fd3.com.company.gamename
Hope it helps!
January 13th, 2010 at 4:33 am
Anyone grabbed an unlocked iphone off ebay? That means i can use it on any network right?
January 30th, 2010 at 9:46 pm
Alot of bloggers not really happy with the new iPad.There was 2 much hype about it and alot people got disapointed.Quite frankly, I for one see lots of the awesome potential of the device. Third-party soft for working with music, games, newsprints and magazine and FFS books, tons of cool stuff, but IMHO they just didn’t really sell it very well (excluding the books). It feels sort of undercooked
February 10th, 2010 at 6:43 pm
My 1st impressions of the iPad are very positive. Apple has once again built a product that looks good and feels great in the hand, and the familiar user interface, borrowed from the iPhone and iPod touch, is perfectly suited to the bigger screen. The iPad whizzes along, opening applications, re-sizing web pages, and zooming in and out of maps almost instantaneously. Does someone know the release date? i love it and i want it…