21

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 in Xcode to specify the correct .entitlements file?

shim
  • 9,289
  • 12
  • 69
  • 108
Viktor
  • 1,020
  • 1
  • 9
  • 22
  • You are doing right by changing Entitlement in `Code Signing Entitlements` section, however your error says something different about your Provisioning Profile that will be different as per app id for you each target? – iphonic Mar 29 '17 at 06:44
  • Yes, profiles with different capabilities for now. I enabled AppleyPay for dev target (feature still in development). But for Prod target, this capability is disabled – Viktor Mar 29 '17 at 07:15
  • I think this [answer](http://stackoverflow.com/a/39667147/790842) will help you. – iphonic Mar 29 '17 at 07:18
  • Link is useful, but for case, when I have different id's for targets. – Viktor Mar 30 '17 at 13:50

2 Answers2

36

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 a unique name Xcode changed the correct files for the respective target.

shim
  • 9,289
  • 12
  • 69
  • 108
Philipp Otto
  • 4,061
  • 2
  • 32
  • 49
29

Go to Project > Target > Build Settings > Signing.

In CODE_SIGN_ENTITLEMENTS, put your path:

$(SRCROOT)/ProjectName/PathToFolder/YourProject.entitlements

Here in Debug and Release you can choose different path.

ricardopereira
  • 11,118
  • 5
  • 63
  • 81
ZeroOne
  • 584
  • 4
  • 17