Wednesday, January 7, 2009

CodeSign error: a valid provisioning profile is required

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

This error will appear when you update your provisioning profile in iPhone SDK 2.2
or after the expiration of developer certificate and that you have a new provisioning profile from the developer portal

This is the solution (which is modified from http://www.furmanek.net/54/iphone-sdk-22-codesign-error/)

Suppose you have copied your provisioning profile called "iPhone_Development.mobileprovision" to the Library folder and build & go an old iPhone project called "MyApp", and this annoying error appears

(1) cd ~/Library/MobileDevice/Provisioning\ Profiles/

(2) find out the UUID of the provisioning profile
strings iPhone_Development.mobileprovision | grep "<string>.*-.*</string>"

output is like this
<string>xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx</string>

(3) copy that UUID between the string tag

(4) close xcode and go to your project
cd ~/Projects/MyApp/MyApp.xcodeproj

(5) Use a text editor to open the project.pbxproj
find the string PROVISIONING_PROFILE

paste the UUID that you copied from step (3) and put it in both Debug and Release Sections (do multiple finds) for the following line
e.g.
PROVISIONING_PROFILE = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";

(6) Launch XCode and open the project and build & go again


Updates :
Deleting all of the lines "PROVISIONING_PROFILE" in project.pbxproj will also fix the problem for iPhone SDK 3 or above





41 comments:

Anonymous said...

You're my hero !!!!!!

Anonymous said...

Thanks so much. This came up in a Google search for the error string and it's been a great help -- the last step I needed before getting my app to run on my iPod Touch. The only info to add is that users should do multiple finds for PROVISIONING_PROFILE, as my pbx file had four separate instances that needed fixing.

Anonymous said...

Very very helpful.

Anonymous said...

A million thanks. I was putting off trying to fix this problem, and you just saved me countless hours of frustration. I even cleaned up a bunch of old, useless PROVISIONING_PROFILE lines while I was there.

Anonymous said...

The PROVISIONING_PROFILE settings may be vestigial. New projects don't acquire them and simply deleting them fixed it for me; your mileage may vary. Nice of Apple to exclude these from the Info panes. >:-(

Anonymous said...

Thank you! That helped me a lot :D

Anonymous said...

I can't imagine how long this would've taken me to fix without this post. Your blogging is much appreciated.

Anonymous said...

Awesome, thank you so much!!!

Anthony Picciano said...

Add me to the "exceptionally grateful" list. The problem apparently still exists with SDK 2.2.1. I had to update the provisioning profiles to add a developer and all heck broke loose until I found this.

I can stop restoring iPhone now.

WaveMotionEngine said...

Doood.... Deleting all of the lines fixed it for me. Thanks a million!

Anonymous said...

I have the same problem but I can't find the project.pbxproj file. Where is it?

Anonymous said...

It worked!!!! Thank you so much. Now, if you could help me with CSSMERR_TP_NOT_TRUSTED error message that would be perfect. Thanks again.

Adrian

Daniel Drysdale said...

You're a life saver this has been screwing me up for a few days now.

Anonymous said...

I'm also very grateful for your post. I can't believe Apple has made it this hard just to change provisioning profiles! I can't wait until I start pushing out beta copies of my app...

Anonymous said...

legend.

Anonymous said...

Fantastic! So glad I found this...

Small business web site design said...

nice collection

Chuck Smith said...

Wow, I was going crazy until I found this and now I finally can test my app on my iPhone again. Thanks so much!!

web design India said...

Nice post

Aunty Jack said...

Thanks a ton... fixed the problem beautifully. I wouldn't have had a chance of finding it if you hadn't posted this.

Anonymous said...

In the project file it appears that there are 2 sets of build configs (PBXProject, PBXNativeTarget). When my partner modified the provisioning profile and updated the project for it, it appears that it affected only one of these 2 sets.

So when I did "Get Info" on the target object in the project window, I saw an incorrect/vestigial entry in the Build tab for the code signing identity with the old profile UUID. When I just selected the correct one in the menu, it worked. I have no explanation for how it worked like that in my partner's setup...

José Pedro Dias said...

Worked with me. Using XCode for OS 3 beta 4. Thank you!

Anonymous said...

Thanks a lot! I have to use it a lot, please keep this site online :)

Unknown said...

incredible awesome post searched the web for hours without avail first class!

Anonymous said...

It worked for me too, Much Thanks !

Anonymous said...

Thanks for this. Definitely helped when changing profiles.

Zut said...

Add me to the "exceptionally grateful" list, too!!! Spend hours before finding your extrem helpful link. THX!

Unknown said...

I love you! i love internet! :-))))))))

4 hours lost in my live and in this post i find the solution!!

Thanks!!!

Arash Payan said...

Thank you so much! I lost a whole bunch of time over this, and kept creating and recreating new certificates and provisioning profiles to try and solve it.

I just deleted all the PROVISIONING_PROFILE lines and it started compiling! Thank you!

Anonymous said...

Thank you thank you thank you.

Christopher Minson said...

Thanks so much - you just saved me a huge amount of work. You're a god!!!

victor said...

Does not work with iphoneOS 3.1.2. Anyone accomplished deleting PROVISIONING_PROFILE worked with xcode 3.1.4 and iphoneOS 3.1.2? Im on 10.5.8 iAtkos. thanks

Joseph Johnson Jr. said...

Worked for me too, thanks :-)

Filippo said...

YOU ARE A GENIUS!!!!!!
You saved me so many hours.... umbelivable!
Thanks!!!

Wayne said...

I also had to change lines of the form:
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Don't Code Sign";

to

"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";

as it appeared there were duplicated sections and it did not seem possible to do so from within xcode. (don't ask why as this was for a 3rd party project I downloaded from a book)

Adam Krell said...

Thank you!!! This has saved me twice.

Anonymous said...

Works like a charm! Wonderful. I wasted one day in fixing this & finally found this to work.

Thanks a ton.

Robert Gilbert said...

Works on IOS4 also...

I would note that on yourApp.xcodeproj you have to right click and "Show Package Contents" to see the project.pbxproj file.

Also, I didn't delete the lines with PROVISIONING_PROFILE in them. I had...

"PROVISIONING_PROFILE[sdk=iphoneos*]" = "";

...and replaced "" with my correct profile.

Thanks a million!!!

iPad Application Development said...

Thanks for the nice information. I am sure, I will tweet this to my twitter account. This will help a lot of users.

Anonymous said...

Select xcodeproj in xCode 4. Under "Build Settings", find the "Code Signing" section and choose your developer certificate. Swoosh! The error disappears

wiinnova said...

Nice Post. Thanks for sharing