Tried to rebuild 开发者_如何学运维an app that was working just yesterday. Got a message that a profile had expired, so I removed it from the iPod and from iTunes. When I chose a new profile (one with an * in the identifier), I now get an error:
Code Sign Error: Provisioning Profile (long string) can't be found.
What am I missing? I looked through related questions and didn't see this scenario already.
Sometimes your Xcode project file gets messed up, especially if you have an old project and first created it with an older version of Xcode/iPhone SDK.
What you need to do is open up the project file in a text editor, search for the 'long string' from your error and manually erase that line.
In fact, you should just go ahead and erase any line that points to any provisioning profiles. Then reopen the project in Xcode, go to the settings and reselect your new profile. This clears up issues like that most of the time.
The lines that point to the provisioning profiles will look like this:
PROVISIONING_PROFILE = "487F3EAC-05FB-4A2A-9EA0-31F1F35760EB";
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "487F3EAC-05FB-4A2A-9EA0-31F1F35760EB";
Here's a simpler solution that worked for me and which doesn't require the manual editing of the project file:
In Xcode, in the "Groups & Files" pane, expand "Targets" and double-click on your app's target. This brings up the Info pane for the target. In the "Build" section, check the "code signing" section for any old profiles and replace with the correct one.
Note that this is different from double-clicking on your project icon and changing the profile from there. Quite amazing :)
Ori
- Project&Targets Properties -> "Don't Code Sign" -> OK -> cmd+S(or cmd+B);
Project&Targets Properties -> "Your Provision Profile"-> OK
Everything works again!
I agree with Brad's answer, that you can fix this problem by editing your target/project by hand, deleting any lines like this:
PROVISIONING_PROFILE = "487F3EAC-05FB-4A2A-9EA0-31F1F35760EB";
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "487F3EAC-05FB-4A2A-9EA0-31F1F35760EB";
However, in Xcode 4.2 and later, there is a much easier way to access this text and select and delete it. In the Project Navigator on the left, select your project (the topmost line of the Project Navigator). Now simply choose View > Version Editor > Show Version Editor. This displays your project as text, and you can search for PROVISIONING and delete the troublesome line, right there in the editor pane of Xcode.
Just saw a variation on this issue: I went into the project.pbxproj file as per Brad Smith's notes above, except in this case all of the PROVISIONING_PROFILE lines seemed to be correct, with no occurrence of the "bad" profile string that Xcode couldn't find.
However, the fix was the same: deleting ALL of the PROVISIONING_PROFILE lines in project.pbxproj, even though they looked "good" in theory, and then reopening the project in Xcode.
To achieve Brad's solution entirely in Terminal, use these commands
cd [Xcode project parent]
vi [Xcode project name].xcodeproj/project.pbxproj
/[offending provisioning profile] [Enter]
dd
- delete the entire line- Press n until no more are found
- Ctrl+x to save and close
In my case the problem was solved by opening Window -> Organizer, selecting my device and removing the old Provisioning Profile under the "Provisioning" panel on the right. The old one was already marked with a red "x" symbol but the iPhone was still using it.
Besides that profile, also the new one was showing up (with the same name) and after simply relaunching the application I had it running smoothly.
Just spent a hour or so doing this and with the help of Brad's advice and a few additional changes it all worked.
I've done this using the following: 10.7.3, Xcode 4.3.2, iOS 5.1 btw.
1) Right click on your myapp.xcodeproj
and select package contents
2) open project.pbxproj
with a text editor (don't recommend textedit as it may screw up the formatting)
3) Scroll all the way down until you find /* Begin XCBuildConfiguration section */
4) Notice that you have a debug and release sections
5) In the release section take a look at CODE_SIGN_IDENTITY
& "CODE_SIGN_IDENTITY[sdk=iphoneos*]"
it should look something like this:
CODE_SIGN_IDENTITY = "iPhone Distribution: MyCompany LLC";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution: MyCompany LLC";
6) Take a look at PROVISIONING_PROFILE
and "PROVISIONING_PROFILE[sdk=iphoneos*]"
they should look like this:
PROVISIONING_PROFILE = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX";
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX";
This should match your provisioning profile in Xcode. To see if they match open Xcode > Window > Organizer > Devices > Provisioning Profiles > Right click on the profile > Reveal in Finder > The filename of the .mobileprovision is your profile id.
7) Scroll down in the project.pbxproj
and find a second instance of the release section. The second instance of the release section should end with a comment saying /* End XCBuildConfiguration section */
8) make sure that the second section matches the first section so that CODE_SIGN_IDENTITY, "CODE_SIGN_IDENTITY[sdk=iphoneos*]
, and PROVISIONING_PROFILE
are all filled in.
One suggestion I'll make since no one yet has said it: PLEASE PLEASE PLEASE make a backup of your whole .xcodeproj file BEFORE you start modifying it's contents. Screwing up the project file and having no backup will lead to a very very unpleasant experience.
Being able to back out of an edit can be a godsend.
Select the lines in codesigning that are blank under Any iOS SDK and select the right certificate.
The solution of Brad Smith worked for me, but I also had to remove the CODE_SIGN_IDENTITY field to make it work.
I just encountered this problem in my Xcode 4. To fix it, you need to put all the correct provisions into both Debug and Release config.
I was trying to submit (by archiving) my app. So I just change the Debug provisions to "Don't Code Sign", and the Release provision to my app's appstore provision.
This fix it and enables me to archive normally. Hope that helps.
Unfortunately this approach didn't work out for me. But here's a fix which worked for me (to get this to work you need a working project file on Subversion or so):
I did roll back to an working version of my project file. As it isn't possible to revert with Xcode (Where is the 'Revert' option in Xcode 4's Source Control?) - I used Tortoise, my Windows machine and this Tutorial (http://tortoisesvn.net/docs/nightly/TortoiseSVN_en/tsvn-howto-rollback.html) to roll back to an older project file.
As the Tutorial didn't work out for me, I just used Tortoise to save the working revision of my project file to an usb stick to port it to my mac. After that I replaced the new broken project file with the old working one, cleaned and it worked like a charm!
At least in Xcode 5, this is the thing that solved the problem for me:
Under provisioning profile, select the offending provisioning profile and then select a valid provisioning profile in the pull-down menu.
You Could remove old reference of provisioning file. Then after import new provisioning Profile and selecting Xcode builder.
I was having issues because I updated my AdHoc provisioning profile with some new devices for use on TestFlight. Assumedly this is happening because Xcode has an old reference to your provisioning profile in either the codesigning build settings for the project or the targets. The way I fixed mine was to:
- Go to both target build settings and project build settings, Under code signing change all the provisioning profiles to something else.
- Go to devices/provisioning profiles in the Organizer delete the offending profiles, then click the refresh button in the bottom right.
- Go back to to the target and project build settings and set your provisioning profiles to the appropriate (hopefully) newly refreshed provisioning profiles.
精彩评论