Enabling App Services

Certain app services—such as iCloud and push notifications—are available only to apps distributed through the store and require additional configuration in your Xcode project, Member Center, and sometimes iTunes Connect. To avoid code signing and provisioning issues, let Xcode perform the configuration steps for you when you enable these app services in your Xcode project. There should be no need for you to configure the Xcode project or enable these app services in Member Center yourself.

View App Services

The key app services you can add to your app are listed in the Capabilities pane in the project editor. Be sure to select the correct target in your project before enabling app services.

To open the Capabilities pane

  1. Choose View > Navigators > Show Project Navigator.

  2. Choose the target from the Project/Targets pop-up menu or in the Targets section of the second sidebar if it appears.

    ../Art/5_choose_target_2x.png../Art/5_choose_target_2x.png
  3. Click Capabilities to view key app services.

    The app services available for iOS and Mac apps are different. The screenshot below shows the Capabilities pane for an iOS app.

    ../Art/5_capabilities_pane_2x.png

For Mac Apps, Enable App Sandbox

All apps submitted to the Mac App Store are required to use App Sandbox, so if you’re developing a Mac app for the store, enable App Sandbox now.

To configure App Sandbox

  1. In the project navigator, click Capabilities.

    ../Art/5_mac_capabilities_2x.png
  2. If App Sandbox isn’t enabled, select the switch in the App Sandbox row.

    ../Art/5_enableappsandbox1_2x.png

    Xcode adds an entitlements file to your project and enables the App Sandbox entitlement.

  3. In the App Sandbox area, use the checkboxes to set additional entitlements for the app to do its job.

    ../Art/5_enableappsandbox_2x.png

Enable App Services

In most cases, enabling a capability is as simple as turning on a switch. However, some app services—such as iCloud, Keychain Sharing, Passbook, and Background Modes—require more configuration. Additional options and instructions for those app services appear after the capability is enabled. Other app services—such as Game Center, In-App Purchase, and Maps—require additional configuration in iTunes Connect and are not covered in this document.

To enable a capability

  1. In the project navigator, click Capabilities.

  2. Click the disclosure triangle next to a capability and read its description.

    Xcode displays the steps it will perform to enable the capability, so you don’t need to perform these steps yourself. For example, to view Game Center configuration steps, click the disclosure triangle next to Game Center.

    ../Art/5_enable_game_center_2x.png
  3. Select the switch in the row of the capability you want to enable.

    For example, to enable Game Center, select the switch in the Game Center row. If Xcode successfully enables the capability, checkmarks appear to the left of the configuration steps, as in the screenshot below for an iOS app:

    ../Art/5_enable_game_center_success_2x.png

    Some configuration steps include adding frameworks to your project. For example, when you enable Game Center, GameKit framework is added to your project.

  4. If an error occurs, follow the instructions in the error message, and click the Fix Issue button to resolve the problem.

    For example, Xcode may fail to communicate with Member Center and complete all the steps. When you click the Fix Issue button, Xcode attempts to perform any remaining steps.

After enabling app services in your Xcode project, click the Run button in the project navigator to build and run your app using the new team provisioning profile.

Verify App ID Entitlements

To better understand how provisioning works, verify that Xcode adds entitlements to your App ID (according to the app services you enabled) and regenerates the corresponding team provisioning profile.

Remember that Xcode initially creates a team provisioning profile containing a wildcard App ID that can be used to sign multiple apps and enable some app services. For example, if you enable Passbook, the Passbook entitlement is added to the wildcard App ID. Later, when you enable app services that require an explicit App ID, Xcode registers an explicit App ID that uniquely matches the app’s bundle ID. Xcode then creates another team provisioning profile that contains the explicit App ID. If an App ID already exists for your app, Xcode uses it in the team provisioning profile instead. Therefore, you may see multiple team provisioning profiles in your account—one for the wildcard App ID and one for each explicit App ID in your account.

View Provisioning Profiles in Xcode

Whenever you create a development certificate, register a device, or change an entitlement, Xcode regenerates and downloads the team provisioning profile. You can view the downloaded provisioning profiles in Xcode.

To view your team provisioning profile in Xcode

  1. Choose Xcode > Preferences, and click Accounts at the top of the window.

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

    In the dialog that appears, view iOS Team Provisioning Profile or Mac Team Provisioning Profile in the Provisioning Profiles table. The Entitlements column contains a whitelist of the services your app can use. If your team provisioning profile uses the Xcode-managed wildcard App ID—where the bundle ID search string is an asterisk (*)—the entitlements are a superset of all your apps that use this team provisioning profile. Place the pointer over the entitlements icons to see each entitlement key.

    For example, Xcode uses the wildcard App ID if only Passbook is enabled in this screenshot for an iOS app:

    ../Art/5_view_wildcard_team_profile_in_xcode_2x.png../Art/5_view_wildcard_team_profile_in_xcode_2x.png

    If you enable iCloud, which requires an explicit App ID, Xcode creates a new provisioning profile using the explicit App ID, as shown in the iOS app screenshot below.

    ../Art/5_view_explicit_team_profile_in_xcode_2x.png../Art/5_view_explicit_team_profile_in_xcode_2x.png

    For iOS apps, if you enable an app service that requires an explicit App ID, both the Game Center and In-App Purchase entitlements are added to your App ID by default. Therefore, Game Center and In-App Purchase entitlements appear in the Entitlements column. For Mac apps, In-App Purchase is enabled by default for an explicit App ID. However, to use these services from your app, enable them in the Capabilities pane.

View Provisioning Profiles in Member Center

You can view the same entitlement settings in Member Center that you view in Xcode, but you can see more details of the provisioning profiles in Member Center.

To view your team provisioning profile in Member Center

  1. In Certificates, Identifiers & Profiles, under Provisioning Profiles, select All or Development.

    If you add a capability that requires an explicit App ID, multiple active team provisioning profiles appear. Xcode uses the team provisioning profile containing the explicit App ID that matches your app’s bundle ID; otherwise, Xcode uses the team provisioning profile containing the wildcard App ID.

  2. Select iOS Team Provisioning Profile or Mac Team Provisioning Profile.

    The entitlements appear in the Enabled Services list and should match the entitlements you viewed in the Accounts preferences in Xcode. The entitlements in Member Center may be a superset of the entitlements you added to your project using the Capabilities pane. (For iOS apps, In-App Purchase and Game Center are enabled by default for an explicit App ID.)

    ../Art/5_developer_portal_profiles_2x.png

Verify the App ID Settings

Xcode adds entitlements to an App ID, not to a team provisioning profile, so verify App ID settings in Member Center to learn where this information is located.

To verify the App ID settings

  1. In Certificates, Identifiers & Profiles, select Identifiers, and under Identifiers, select App IDs.

  2. Select the explicit App ID that matches your bundle ID if it exists; otherwise, select the Xcode-managed wildcard App ID.

    A green circle followed by “Enabled” appears in the Development column of the services your app can use.

    ../Art/5_verifyappid_2x.png

You can also edit App ID settings using Member Center, but any changes you make in Member Center won’t configure app services in your Xcode project. Use the Capabilities pane in Xcode to fully configure app services. Push notifications is the only service, shown in Member Center, that Xcode doesn’t configure for you.

Learn More About App Services

Refer to this table for more information on key app services that appear in the Capabilities pane in Xcode or require additional configuration using Xcode, Member Center, or iTunes Connect.

To learn about

Read

App Sandbox

Provides the last line of defense against stolen, corrupted, or deleted user data if malicious code exploits your Mac app.

Configuring App Sandbox for Mac Apps

App Sandbox Design Guide

Entitlement Key Reference

iCloud Storage Key-Value and Document Storage

Allows sharing of user’s data among multiple instances of your app running on different iOS devices and Mac computers.

Adding iCloud Support

iCloud Design Guide

CloudKit

Provides a database-like model for storing both private and public data where public data is owned by the app and can be shared among all users of the app.

CloudKit Quick Start

CloudKit Framework Reference

Game Center

Allows players to connect devices to Apple’s social gaming network and to exchange information.

Game Center Programming Guide

Game Center Configuration Guide for iTunes Connect

Passbook

For iOS apps, presents digital representations of information—such as a coupon, ticket for a show, or boarding pass—that allow users to redeem a real-world product or service.

Configuring Passbook for iOS Apps

In-App Purchase

Embeds a store directly into your app by accessing the store and securely processing payments from the user.

In-App Purchase Programming Guide

In-App Purchase Configuration Guide for iTunes Connect

Maps

Makes your app’s routing information available to Maps and other apps that need point-to-point directions.

Configuring Maps

Background Modes

Enabling background modes allows your app to continue running in the background.

Configuring Background Modes for iOS Apps

Keychain Sharing

Allows your app to share passwords in the keychain with other apps developed by your team.

Configuring Keychain Sharing

Inter-App Audio

Allows your app to export audio that other apps can use.

Inter-App Audio Examples

Data Protection

For iOS apps, adds a level of security to files stored on disk by your iOS app.

Protecting Data Using On-Disk Encryption in iOS App Programming Guide

HomeKit

For iOS apps, provides integration between accessories that support Apple's Home Automation Protocol and iOS devices.

HomeKit Framework Reference

HealthKit

For iOS apps, provides a structure that apps can use to share health and fitness data.

HealthKit Framework Reference

Push Notifications (Apple Push Notification service)

Allows an app that isn’t running in the foreground to notify the user that it has information for the user.

Configuring Push Notifications

Local and Remote Notification Programming Guide

Newsstand

For iOS apps, enables an app to organize a user’s magazine and newspaper app subscriptions into a folder.

Newsstand for Developers

Newsstand Icons in iOS Human Interface Guidelines

Recap

In this chapter, you learned how to enable some app services that Apple provides for apps submitted to the store. By examining your team provisioning profiles and App IDs in Member Center, you gained a deeper understanding of how provisioning works. You also learned where to find more information on these app services.