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
Choose View > Navigators > Show Project Navigator.
Choose the target from the Project/Targets pop-up menu or in the Targets section of the second sidebar if it appears.
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.
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
In the project navigator, click Capabilities.
If App Sandbox isn’t enabled, select the switch in the App Sandbox row.
Xcode adds an entitlements file to your project and enables the App Sandbox entitlement.
In the App Sandbox area, use the checkboxes to set additional entitlements for the app to do its job.
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
In the project navigator, click Capabilities.
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.
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:
Some configuration steps include adding frameworks to your project. For example, when you enable Game Center, GameKit framework is added to your project.
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
Choose Xcode > Preferences, and click Accounts at the top of the window.
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:
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.
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
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.
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.)
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
In Certificates, Identifiers & Profiles, select Identifiers, and under Identifiers, select App IDs.
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.
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
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
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.
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.
Allows players to connect devices to Apple’s social gaming network and to exchange information.
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
Embeds a store directly into your app by accessing the store and securely processing payments from the user.
Makes your app’s routing information available to Maps and other apps that need point-to-point directions.
Enabling background modes allows your app to continue running in the background.
Allows your app to share passwords in the keychain with other apps developed by your team.
Allows your app to export audio that other apps can use.
Inter-App Audio Examples
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
For iOS apps, provides integration between accessories that support Apple's Home Automation Protocol and iOS devices.
HomeKit Framework Reference
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
For iOS apps, enables an app to organize a user’s magazine and newspaper app subscriptions into a folder.
Newsstand Icons in iOS Human Interface Guidelines
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.