Adding Extra Entitlements
8.3. How Do I Add Extra Entitlements (a.k.a Application Services) to My App?
Entitlements grant your application specific permissions or capabilities, such as accessing iCloud, Push Notifications, HealthKit, or App Groups. These are defined in an .entitlements
file, which is a property list (plist) XML file.
Steps to Add Entitlements:
Create an
.entitlements
File:Create a new text file in your project directory. Name it something like
YourApp.entitlements
(e.g.,MyCoolApp.entitlements
).The content of this file should be XML in the property list format.
Example for enabling App Groups:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "[http://www.apple.com/DTDs/PropertyList-1.0.dtd](http://www.apple.com/DTDs/PropertyList-1.0.dtd)"> <plist version="1.0"> <dict> <key>com.apple.security.application-groups</key> <array> <string>group.com.yourcompany.yourapp</string> </array> </dict> </plist>
You can find the keys for various entitlements in Apple's documentation (search for "Adding Capabilities to Your App" or specific entitlement keys).
Configure App ID:
In the Apple Developer Portal, ensure your App ID (it must be an explicit App ID) is configured with the corresponding capabilities/services that match your entitlements file. For example, if you add the
com.apple.security.application-groups
entitlement, you must enable the "App Groups" capability for your App ID and configure the group.
Update Provisioning Profile:
After configuring the App ID with new capabilities, you must regenerate your provisioning profile(s) associated with that App ID. Download the new profile and import it into the Keychain Tool. The new profile will include the enabled capabilities.
Specify Entitlements File in
make.cmd
:Open your project's
make.cmd
file.Locate or add the
DBE_ENTITLEMENTS_FILE
variable.Set its value to the name of your entitlements file:
set DBE_ENTITLEMENTS_FILE=YourApp.entitlements
If this variable is defined, the build system will pass the entitlements file to the code signing tool.
Rebuild Your App:
After making these changes, rebuild your application. The new entitlements will be embedded in your app's signature.
Important Considerations:
Mismatch: If your entitlements file specifies capabilities not enabled in your App ID and provisioning profile, the app may fail to install or run correctly, or the code signing process might fail.
Distribution: Ensure that both development and distribution provisioning profiles are updated if you need the entitlements for both types of builds.
Last updated