Set Up Device For Development

Estimated reading: 6 minutes 57 views

Prepare for your build

To prepare to distribute your build, you need:

  • An App ID that you set up for your app in your developer account.
  • A signing certificate with the public and private key. On iOS, iPadOS, watchOS, or tvOS you need a distribution certificate; on macOS you need a development certificate. For more information on signing certificates, see Certificates.
  • A list of test devices registered in your developer account.
  • A provisioning profile for your app and list of test devices. On iOS, iPadOS, watchOS, or tvOS you need a distribution profile; on macOS you need a development profile.

If you choose the default automatic signing, Xcode creates the provisioning profiles for you, that include all your registered devices; for more advanced cases like large teams with restricted access to signing assets or to only include a subset of your registered devices, prepare your provisioning assets manually. In both automatic and manual provisioning, you need to gather and add your list of test devices to your developer account. When you manually provision a profile, update your provisioning profile after adding test devices.

Each iOS, iPadOS, tvOS, watchOS, and macOS device has a persistent, unique identifier referred to as a device ID. When you use automatic signing, Xcode registers the device for you. Otherwise, you need to collect the device ID and register the device in your developer account.

Register devices automatically in Xcode

When you use automatic signing, Xcode registers the connected device or Mac for you. For iOS, iPadOS, or tvOS attach your device to your computer, and select Trust if the device asks to trust your computer. For watchOS, attach the paired phone for your watchOS device to your computer.

In Xcode, select your attached device as the run destination, and build and run your app. For more information on simulated apps, see Running your app in Simulator or on a device. If your device needs to be registered, click the Register button in the dialog that Xcode displays, and Xcode registers and adds the device to your provisioning profile.

Register devices in your developer account

After you collect the device IDs, you can register them all at once by putting the device names and identifiers in a file. Sign into your developer account, then:

  1. Select Certificates, Identifiers, and Profiles.
  2. Select Devices.
  3. Click Download Sample File for an example file.
  4. Customize the example file with your specific device information.
  5. Upload the device file.

For more information on multi-device registration, see Register multiple devices.

Add a single device by clicking the plus (+) button next to the Devices title. Specify the identifier and a name for the device. Use a name that makes the device easy to identify; for example, combine the owner’s name and device type, ”Ravi Patel’s iPhone 11”.

You can disable devices that you no longer permit to use your app: select the device and click Disable. Code signing doesn’t include the device while it’s disabled, but the device counts against the number of devices in the product family until your account renewal date. Disabling a device invalidates any provisioning profiles that include the device; automatic signing regenerates the profile the next time you build your app, or you can regenerate the profile manually if you’re not using automatic signing.

Update your provisioning profile

When you use automatic signing, Xcode automatically updates the provisioning profile when you export the app.

To use manual signing, sign into your developer account, select Certificates, Identifiers, and Profiles, then select Profiles. Click the plus sign next to the Profiles header to create a new provisioning profile. Then:

  1. Select the type of profile by type and platform.
  2. Select your App ID.
  3. Select the signing certificate.
  4. Select the device or devices to include in the profile.
  5. Provide a name for the profile.
  6. Select Generate.

You can edit an existing profile and regenerate it to add or remove devices. Once you generate the profile, download it, then drag the downloaded profile to the Xcode dock icon and drop it to install it. You can also download it from Xcode Preferences > Accounts, using the Download Manual Profiles button when you select your account.

Archive the app

In the main window of your Xcode project, choose a target and a build-only device or real device from the Scheme toolbar menu. You can’t create an archive when the target is a simulator. Choose Product > Archive to build the target and Xcode displays the archive in the Archives organizer.

For a Mac app built with Mac Catalyst, create separate archives for the iPad and Mac version. When creating the archive for the Mac version, choose My Mac as the run destination.

Export the app

From the archive, export a version of the app to distribute to users:

  1. In the Archives organizer, select the archive, then click Distribute App.
  2. Select the Ad-Hoc or Development method to distribute your app to registered devices.
  3. If you’re using manual signing, select your distribution provisioning profile, otherwise let Xcode perform any updates necessary for automatic signing.
  4. Save the exported app.

For more information on solving issues with code signing, see Code Signing.

Install the app on user devices

When you save the exported app, Xcode creates a folder that contains a few files, including the iOS App file, which is a file with an .ipa filename extension. Distribute that file to your users so they can install it on their devices by using Xcode or Apple Configurator 2.

For macOS, double-click the file to install and run it.

To install iOS, iPadOS, tvOS, or watchOS apps using Xcode:

  1. Attach the device to the computer, or attach the paired phone for a watchOS device.
  2. Select Window > Devices and Simulators, and then select the Devices tab.
  3. Select the attached device.
  4. Click the Add button (+) under the Installed Apps section.
  5. Select the iOS App file to install the app.

To install iOS, iPadOS, tvOS, or watchOS apps with Apple Configurator 2:

  1. Attach the device to your Mac, or attach the paired phone for a watchOS device.
  2. Select the attached device.
  3. Click the Add button (+).
  4. Select the iOS App file to install the app.

Leave a Comment