Launching Your App on Devices

All apps that use app services must be provisioned and code-signed to launch on a device. When you created the team provisioning profile in an earlier chapter, Xcode set the project code signing and provisioning build settings for you. Now when you click the Run button, Xcode builds your app, embeds the team provisioning profile in the app bundle, and code signs the app. The app launches on a device (for iOS apps, an iPad, iPhone, or iPod touch) if that device is in the team provisioning profile. Similarly, a Mac app that uses certain app services launches if the Mac is in the team provisioning profile. If you connect another device to your Mac, Xcode registers and adds it to the team provisioning profile before building your app.

About Devices

A device ID uniquely identifies an iOS, tvOS, watchOS, or Mac device. Your team can register up to 100 devices per product family per year to use for development and testing. For iOS apps, you can register 100 iPad, 100 iPhone, and 100 iPod Touch devices. As a convenience, all devices you register through Xcode are automatically added to the team provisioning profile.

Launch Your App

If you previously created your team provisioning profile, as described in Creating Your Team Provisioning Profile, it takes just a few steps to launch your iOS, tvOS, or watchOS app on a device, and just one click to launch your Mac app.

Launch Your Mac App

To launch your Mac app, click the Run button in the project navigator. If a prompt appears asking whether codesign can sign the app using a key in your keychain, click Always Allow.

Launch Your iOS, tvOS, or watchOS App

You can use the same device that you added to the team provisioning profile in an earlier step or connect another device that matches your deployment target.

To launch your app on a connected device

  1. Connect the device to your Mac.

    For watchOS apps, connect an iPhone that is paired with an Apple Watch. Xcode will register both the iPhone and the Apple Watch.

  2. In the project navigator, choose your device from the destination Scheme pop-up menu.


    If your device is not selectable from the Scheme pop-up menu because it is ineligible, fix the issue before continuing. For example, if the device doesn’t match the deployment target, upgrade the version of the operating system on the device. Alternatively, choose the version you want to target from the Deployment Target pop-up menu in the Deployment Info section, and then select the device from the Scheme pop-up menu.

  3. Click the Run button.

    Xcode installs the app on the device before launching the app.

  4. If a “No matching provisioning profile found” warning message appears under the Team pop-up menu, click the Fix Issue button.

    If you connect a device that isn’t in the team provisioning profile, Xcode needs to add it to the team provisioning profile before it can launch the app on the device.

Verify Your Profiles

To better understand how Xcode manages the team provisioning profile for you, compare your code signing and provisioning assets in Xcode, your developer account, and Keychain Access.

Verify Signing Identities and Profiles Using Xcode

Xcode shows the signing identities that appear in your keychain and any provisioning profiles it downloads from your developer account. After you launch your app on a device, your development certificate and team provisioning profile should appear in Xcode.

To view signing identities and provisioning profiles in Xcode

  1. Choose Xcode > Preferences.

  2. At the top of the window, click Accounts.

  3. Select the team you want to view, and click View Details.

    In the dialog that appears, view your signing identities and provisioning profiles. For iOS, tvOS, and watch OS apps, an iOS Development signing identity and appropriate team provisioning profile appear. For Mac apps, a Mac Development signing identity and a Mac Team Provisioning Profile appear. A Create button appears in the Action column for signing identities aren’t needed.

  4. Click Done to close the dialog.

Verify Your Certificates, Identifiers, and Profiles Using Your Developer Account

If you join the Apple Developer Program, you have access to your assets stored in your developer account. Your assets include your certificates, identifiers (including device IDs and App IDs), and provisioning profiles.

View Your Certificates

Initially, you’ll use a development certificate to run your app on devices, but later you’ll create different types of certificates to distribute your app. Only the public keys for your certificates are stored in your developer account.

To view certificates in your developer account

  1. In Certificates, Identifiers & Profiles, select Certificates.

  2. In the Certificates section, select All or Development.

    The name, type, and expiration date of the certificate should match the information that you view in Xcode. For iOS, tvOS, and watchOS apps, an iOS Development certificate should appear and for Mac apps, a Mac Development certificate should appear. The screenshot below shows an iOS certificate.


View Your Devices

Because you can register devices using Xcode and your developer account, it’s a good idea to occasionally verify all the devices for your team.

To view your devices

  1. In Certificates, Identifiers & Profiles, select Devices.

  2. In the Devices section, select All or a device family.

    On the right, the name and identifier for your devices appear. Enabled devices appear in black text, and disabled devices appear in gray text.

View Your App ID and Team Provisioning Profile

Initially, Xcode registers a wildcard App ID and creates a corresponding team provisioning profile on your behalf that can be used by all your apps. Later, when you enable app services, Xcode may create an explicit App ID that matches your app’s bundle ID.

To view your wildcard App IDs and team provisioning profile

  1. In Certificates, Identifiers & Profiles, select Identifiers.

  2. In the Identifiers section, select App IDs.

    The wildcard App ID that Xcode registers is called XC Wildcard. Explicit App IDs that Xcode registers for you begin with the text “XC”.

  3. Select Provisioning Profiles.

  4. In the Provisioning Profiles section, select Development.

    The team provisioning profile contains the text “Team Provisioning Profile” preceded by the operating system name. iOS and watchOS apps may use the same wildcard team provisioning profile.

  5. Click the team provisioning profile to view its details.


    Verify that the number of certificates and devices equals the number of development certificates and devices you viewed in the Certificates, Identifiers & Profiles section. If you’re an individual, the number of development certificates in the team provisioning profile should be 1. Enabled Services should be None (unless you or a team member previously enabled services).

Verify Signing Identities Using Keychain Access

Your signing identity—which includes the certificate with its public and private key—is stored in your keychain. Xcode alerts you if there’s a problem with a signing identity, but it’s useful to know where signing identities appear in Keychain Access in case you need to troubleshoot them yourself.

To verify signing identities using Keychain Access

  1. Launch Keychain Access, located in /Applications/Utilities.

    When you request a development or distribution certificate using Xcode, the certificate is automatically installed in your login keychain.

  2. In the left pane, select “login” in the Keychains section, and select Certificates in the Category section.

    For iOS, tvOS, and watchOS apps, the name of the development certificate begins with the text “iPhone Developer”, and for Mac apps, the name begins with “Mac Developer”, followed by your name (development certificates belong to a person).

  3. Verify that the certificates are valid.

    When you select a certificate, a green circle containing a checkmark appears in Keychain Access above the list of certificates. The text next to the checkmark should read “This certificate is valid.”

  4. To view your private key, click the disclosure triangle to the left of the certificate name.

    If the disclosure triangle doesn’t appear, your private key is missing. If this happens, you’ll need to import the signing identities from another Mac or re-create them.



In this chapter, you learned how to launch your app on devices. You also learned more about Xcode-managed team provisioning profiles by using different tools to view your code signing and provisioning assets.