SpyMachine
SpyMachine

Reputation: 470

Xcode won't choose correct Provisioning Profile

I have an app with a distribution certificate with an app id. I have downloaded the distribution profile into my organizer and set the bundle id in info.plist to the app id. However, when I try to archive the project, I get

Code Sign error: Provisioning profile '...' specifies the Application Identifier '...' which doesn't match the current setting 'mybundleid'.

Xcode is looking at a different provisioning profile and saying it's wrong, but I don't want to look at that provisioning profile, I want it to look at a different one. In Build Settings, it even says "(currently matching...) to my correct provisioning profile, so I don't get what's going on.

I also did try removing the wrong profile, but then it gave me another error that the provisioning profile did not exist.

Does anyone know what I'm missing here? Thanks.

Upvotes: 8

Views: 10690

Answers (4)

Oz Solomon
Oz Solomon

Reputation: 3044

I had this problem in XCode 6. I had two targets in my project, and one of them always built with the wrong profile, no matter what I did (including changing the Provisioning Profile setting in Build Settings).

After hours of playing around with it, I noticed the following:

  1. The good target was using a provisioning profile called "XC: com.mycompanyname.mytargetname1"
  2. The broken target was using a profile called "XC: ". This profile is the "Xcode: Wildcard AppID ()" profile.

I don't know where either of these came from, but what I did to fix my problem was this:

  1. Log into developers.apple.com
  2. Go to Certificates, Identifiers & Profiles
  3. Clicked on "All" under Provisioning Profiles on the left bar
  4. Clicked on "+"
  5. Created a new profile called XC: com.mycompanyname.mytargetname2 (NOTE: the settings will be specific to you. The com.mycompanyname.mytargetname2 should be replaced by your app's bundle ID.

After that it worked.

Upvotes: 4

devjoe
devjoe

Reputation: 81

I got the same issue last night, worked on it for 5+ hours. I finally figured it out this morning, turned out I was change the build settings of the project, instead of the target in Xcode...

Upvotes: 8

Or Arbel
Or Arbel

Reputation: 2975

Make sure the bundle id in the info plist, is the same as the one that used to create the profile in iPhone developer center.

then make sure the correct profile is selected in the target settings.

Upvotes: 5

user529543
user529543

Reputation:

I bet you need to delete all provisioning profiles and add all back what need. That solved this case too.

Upvotes: 5

Related Questions