How to set different .entitlements file for different targets

Viktor picture Viktor · Mar 29, 2017 · Viewed 7.7k times · Source

I have 2 targets - Dev & Prod config with different capabilities (Apple Pay disabled for Prod)

I already have separated Info.plist files with needed target But I couldn't do same for Proj.entitlements files - Target Membership section in Utilities menu disabled

I set corresponding "Code Signing Entitlements" in Build Settings of each target, but still receiving "Provision Profile 'X' doesn't support 'X' capability" in General tab

Is there any way to say XCode, that for this target he should look at connected .entitlements file?

Answer

Philipp Otto picture Philipp Otto · Sep 21, 2017

I also tried to set separate entitlement files for my targets to activate push notifications only for some of my targets. Every time I changed the capabilities of one of my targets the changes were also applied to the other targets because XCode only edited the same entitlements file all the time although I set a different file path for each target in

Build Settings > Code Signing Entitlements

For me the problem was that the entitlement files all had the same name. When I gave every target entitlement file an unique name XCode changed the correct files for the respective target.