Hi. This is kind of a quick-and-dirty article about how certs and profiles work, because they're boring to read about and hard to understand (for me).
This is my understanding of how they work. This might not be completely accurate, but it's been enough to work with. I'll cover the concept as fast as possile, and then a practical example.
Before we get into it, terms:
cert, certificate = signing certificate
profile = provisioning profile
Let's start.
Certs and Profiles: concept
Certificates
Certificates are basically permission vouchers to build your app for a specific purpose.
We have two major categories of certs: Development and Distribution.
Development is for local debugging (think hooking a device up to your computer via usb).
Distribution is for making non-debug, stand-alone files that are usually used in two ways.
Ad-Hoc: you plan to distribute your app to a few devices outside the app store for testing.
AppStore: Apple will distribute them on the App Store.
For Ad-hoc, you'll almost always use it in the super-early starting phase of your Dev to make sure your app builds correctly and then never again because Testflight is just better.
Profiles
A profile is tied to a specific certificate (again, for development or distribution) and is a permission slip to build an app for a specific set of devices.
Note that a build profile that is tied to an AppStore cert will not ask you to specify devices, because Apple will distribute it to the world at large.
Actual practical example
So, in this example I'll go through development that starts on an iPhone and then goes to iPad.
Step 0) Buy an iPhone.
Step 1) Go into your Apple developer account and click on certificates. Right now we just want to do some dev and testing via USB, so we choose development.
Step 2) Add the iPhone we just bought to our Apple Developer Account list of devices. This is an account-wide list of all the devices you want to use for dev.
Step 3) Go to the profiles section. Click create profile. When it asks you what cert you want this to apply to, click the development cert we just made. It will ask what devices you want the profile to allow installation for - click your iPhone. Done.
Now we can use this cert and profile to do some dev. After a while, we realize that we want to test on iPad as well.
Step 4) Buy an iPad.
Step 5) Go back into your Apple Developer Account and add the iPad to your devices list.
Step 6) Create a NEW profile. We have to make a new one because we cannot edit old profiles to add devices to them. The new profile will ask what cert (our only cert, the dev one) and what devices (check iPhone AND iPad). Done.
Now we can do dev on both.
After a while, we want to upload to the app store. Good.
Go to the Apple Dev Portal, create a cert, but this time choose distribution - App Store.
Then create a new profile and at the cert step, choose the cert we just created.
Done.
I hope this was helpful.