Entitlements / Capabilities per Xcode scheme

You can achieve the desired behaviour by using a different build configuration.

  1. Copy the entitlements file and adjust it to your needs, e.g, remove the Apple Pay entitlement for enterprise distribution
  2. Select the project on the project settings view
  3. Add a new build configuration, e.g., AppStore Xcode project settings
  4. Switch to your app target and adjust the value for the new build configuration. Target build settings
  5. Create a new scheme, e.g., AppStore and select the new build configuration in the "Archive" Section of the scheme settings Scheme settings

In general, it is a good idea to have separate schemes and build configurations. That way you can support several different build configurations depending on your needs, e.g., Enterprise distribution, Hockey Testing, App Store etc. .

If you want to make your project setup more maintainable consider using xcconfig files to organize your build settings.


A possible approach:

  1. Put your different schemes' entitlements files in a folder
  2. Have your project or target's Build Settings > Code Signing Entitlements point to a location such as $(PROJECT_DIR)/AppName/AppName.entitlements
  3. In Edit Scheme > Build > Pre-actions, add a "Run Script" action to copy the entitlements file for that scheme, to the location you specified in step 2. e.g. cp ${PROJECT_DIR}/entitlements/DevScheme.entitlements ${PROJECT_DIR}/AppName/AppName.entitlements

Tags:

Ios

Xcode