27
votes

I am new to iPhone development. I just registered with Apple for the iPhone Developer Program. When I try to build, I am receiving an error:

Code Sign error: a valid provisioning profile matching the application’s identifier could not be found

I'm not sure what is wrong. I tried browsing the Internet but I get confused. Can anyone help me with what I should do?

6

6 Answers

38
votes

At first it seems a complex process, but it's pretty straightforward when you've been through it a few times.

In a nutshell the process is this:

(I'm assuming you've set up your iPhone/iPod touch as a test device)

Via the iPhone Developer Portal

  1. Create an App ID (give your application a name, this is just for reference on the website and nothing to do with your own build of your application) enter a string to identify it, like com.yourcompany.appname (this is important and should be the same as in your .plist file inside Xcode) Click and Save this

  2. Go to Provisioning There are 2 provisioning profiles you'll need a) development - so you can install your application on a test device (i.e. your iPhone / iPod touch) b) distribution - if you want to sell the application via the App Store

    You can create the profiles by selecting your App ID, created in the previous step, from the drop down list and clicking Save In a few moments (usually, though it can be longer) the certificate is available for download. Download this to your Mac and drop it onto the Xcode icon. Sometimes the development profile doesn't work for me like this and I drop it directly into the Organiser window in Xcode that shows my connected device.

    Besides, if you are in a team account, team admin need to edit Development Provisioning Profiles, and add modify your certificates privilege.

  3. In Xcode inside 'Edit Project Settings' you can select the certificate you wish to code sign with. Usually for debug I sign with the development certificate. Follow the instructions on the apple site and clone the release profile and call it something like release and sign this with your distribution profile. (You won't be able to load the app onto your phone with the distribution profile selected)

  4. Make sure you select the target device as Device and not Simulator when building for the App Store!

Hope that helps, it's from memory so apologies if I've skipped some small steps.

6
votes

xcode top left corner make sure you're running as "similator" "iphone"

1
votes

Did you set up an iPhone provisioning profile for either development, ad hoc distribution, or app store distribution?

If not go to the iPhone developer program portal, which is linked from the developer.apple.com/iphone. Apple has provided a great series of video tutorials.

0
votes

Just make sure you install the certificates or the profile won't be selectable in the project configuration. When you download the certificates double-click on them to install.

0
votes

Possibly more use for others seeing this issue on a previously configured dev environment.

This error is also shown if your provisioning profile has expired, in this case you can go through the steps in Neosionnach's answer or you can go to Organizer, click on the profile and click Refresh.

This was the winner for me when I had this issue.

0
votes

As of July 2012, you can go here:

https://developer.apple.com/ios/manage/overview/index.action

Then launch the "Development Provisioning Assistant." It walks through all the steps outlined by FiddleMeRagged.

You can use this process to create a Wildcard ID, if you're just looking to test your app on your iOS device and don't need to deploy to the App Store right away.