Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set different .entitlements file for different targets

Tags:

xcode

ios

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?

like image 261
Viktor Avatar asked Mar 29 '17 06:03

Viktor


People also ask

How do I create an Entitlements file?

Select iOS > Resource > Property List. Name the new file " foo. entitlements " (typically, " foo " is the target name) Click the (+) next to "Entitlements File" to add a top-level item (the property list editor will use the correct schema due to the file extension)

What is an entitlement file?

The entitlements file defines certain capabilities of your app. Usually, the file is automatically generated by Xcode when you enable a capability for your app. You only need the file if you enable certain capabilities, e.g. Healthkit integration. If you'd like to use these features, you have to add it.

How do you set Get task allow?

get-task-allow, when signed into an application, allows other processes (like the debugger) to attach to your app. Distribution profiles require that this value be turned off, while development profiles require this value to be turned on (otherwise Xcode would never be able to launch and attach to your app).


2 Answers

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.

like image 57
Philipp Otto Avatar answered Oct 04 '22 21:10

Philipp Otto


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.

like image 37
ZeroOne Avatar answered Oct 04 '22 20:10

ZeroOne