75

I have been working the whole day to try to build my app on my device.

I get this error when I try to build on my device.

I have been reading about this problem but do not really understand how to fix it. The following is where I would believe the problem is. I am new on this so I have no experience how to solve this.

When I open the "Dont Code sign" I have "Automatic profile selector (recommended)" with two lines I can select and also "My profile for dev" with one line to select. Do not know if this is where the problem is?

Any help is appreciated.

enter image description here

Almas Adilbek
  • 4,371
  • 10
  • 58
  • 97
PeterK
  • 4,243
  • 4
  • 44
  • 74

12 Answers12

244

Here's how I did it.

  • Shut down Xcode.
  • Back up the project.pbxproj file.
  • Edit the project.pbxproj file and remove lines of instances where it mentions the old provisioning profile.
    • eg. Delete line:
    • PROVISIONING_PROFILE = "8D024EDA-DC05-40DF-B3EB-536392615EE2";
  • Restart Xcode and perform a full clean of the project.
  • It should then build without warnings.

Enjoy!

jyap
  • 3,516
  • 2
  • 16
  • 16
  • 12
    Good answer, but note that the project.pbxprof file is inside the .xcodeproj directory. Similar answer here: http://stackoverflow.com/questions/1760518/codesign-error-provisioning-profile-cannot-be-found-after-deleting-expired-prof – Pete May 23 '12 at 12:17
  • Yes, to get to the project.pbxprof you need to right click on the project icon and select `Show Package Contents`. – Eric Brotto May 28 '12 at 10:30
  • Thanks for the answer, can you explain what is it the problem (why this issue is produced ?) please. thanks in advance – iArezki Feb 15 '13 at 09:06
  • @iArezki It is because it is pointing to provisioning profile that it can't find. eg. You probably have a new one and the old one expired. – jyap Feb 20 '13 at 20:46
  • NOTE: You may need to delete more than one line! I deleted only the line suggested above, which didn't fix it, but after doing a Cmd+F search for the provisioning profile ID number I found another line (right below the first one) and deleted that too. – bkbeachlabs Jun 03 '13 at 17:10
34

In my case it was because the xcode 4.0.2 prevented deletion of stale data in the project.pbxpro in the *.xcodepro directory. I ended up hand editing the file after shutting down xcode. In the file I looked for all of the occurrences of "PROVISIONING", something like this:

PRODUCT_NAME = Xyzzy;
PROVISIONING_PROFILE = "CF5F0AEA-92D9-48E1-99DF-301AB36C2BFB";
"PROVISIONING_PROFILE[sdk=*]" = "CF5F0AEA-92D9-48E1-99DF-301AB36C2BFB";
SDKROOT = iphoneos;

and changed it to:

PRODUCT_NAME = Xyzzy;
"PROVISIONING_PROFILE[sdk=*]" = "";
SDKROOT = iphoneos;

I restarted xcode and the build succeeded with out issue. A word of caution make sure that you back up the project directory before make changes to the project files, and only hand edit the files when you have no other options.

Eddy
  • 357
  • 4
  • 6
  • Yes ! This is the case of XCode4.0.2. I faced the same issue right now. – sagarkothari Jul 15 '11 at 13:49
  • Hi Eddy, this works. Is the a less hackier way to fix this though? Anyway I can clear it without having to change the project.pbxproj file directly? Just concerned that changing it will cause other issues that I'm not aware of. Thank you. – teepusink Aug 03 '11 at 20:06
  • Thanks a TON. Spent over 3 hours on this at work wasting all my time. – Chewie The Chorkie Jul 17 '12 at 21:35
  • At least in Xcode 4.5 the same outcome can simply be achieved by changing the `Code Signing Identity` entries to the recommended setting `iPhone Developer` for the debug and respective `iPhone Distribution` for the Release configuration. This internally sets the various `PROVISIONING_PROFILE` sections in project.pbxpro to `""` and lets Xcode decide which profile to use. Be sure to make the changes in the general project section AND in your targets' section. – DEAD10CC Feb 18 '13 at 09:49
12

I went and changed code signing identity the on project and target to "Don't Code Sign" and then changed back to the correct code signing identity. That fixed it for me.

Bill Vernon
  • 121
  • 1
  • 3
  • 3
    Just thought I'd add for those experiencing this problem (that were patient enough to read through all the options) that this - and not hand-editing your project internal data - is the correct answer as of 4.5 – SG1 Feb 05 '13 at 19:49
11

what exactly is the error message? Did you add your device including the required provisioning profile in the organizer? What do you see in the organizer when selecting your iPhone under devices? It should be there with the correct valid profile...

user387184
  • 10,953
  • 12
  • 77
  • 147
7

If you are working with a project created by someone else as a template, you need to change the code signing identity

screenshot: https://i.stack.imgur.com/UIpGS.png (Xcode 4.2)

ps. OSX would not let me edit the .pbxproj file with a text editor

Trevor Jordet
  • 641
  • 6
  • 7
5

I had this problem when I had to reissue development provisioning profiles with new names/ids.

The solution was to update all references in Edit Project Settings | Build (Code Sign) referring to Code Sign Developer (name). (Not Edit Active Executable.)

Click on the item(s) and check that the new profile is explicitly selected, and rebuild and run.

I suspect that the reason you get this error in the first place depends on whether or not you have set xCode up to try to resolve these dependencies automatically. In one of my builds replacing the profile was seamless - in the other I had to manually update it. Clearly the best solution would be a seamless one.

Sean Wallis
  • 51
  • 1
  • 1
3

I had same error where the very previous build built just fine. I noted that my Build Settings -> Code Signing -> Provisioning Profile had been reset to strange one. All I had do is to point it to correct one to resolve the issue.

zeeawan
  • 6,667
  • 2
  • 50
  • 56
  • Thanks Hero!! Worked for me, But I am shocked why provision profile changed automatically. I have noticed that many times, it changed it by itself. – Ravi Jul 26 '16 at 06:21
3

I've had this before, and it just worked by restarting Xcode. Probably won't work for you but I'll throw it out there anyway.

Jonathan.
  • 53,997
  • 54
  • 186
  • 290
2

This one can be fixed by changing the project settings AND clicking Project > Edit Active Executable > Build and changing the settings there.

Oh Danny Boy
  • 4,857
  • 8
  • 56
  • 88
1

I just redid my provisioning profile and re-added devices to the portal in Organizer. Then I clicked my project icon, entered Build Settings, Code Signing and remapped to the new provisioning profile.

geekinit
  • 1,345
  • 2
  • 14
  • 17
0

I had the provisioning profile set to one thing in Projects and another in Targets. Do a search in your project for the file that is missing and see if it pops up. No hand editing needed!

user3344717
  • 161
  • 3
  • 5
0

Like @Jonathan, I just restarted Xcode and it worked after it automatically retrieved the profile from my Apple developer account. This was Xcode 6.2

Bcf Ant
  • 1,639
  • 1
  • 16
  • 26