31

I have downloaded the latest version of Xcode. I want to create Entitlement.plist file in my project.

Please give me proper steps to create an Entitlement.plist file in Xcode.

mfaani
  • 33,269
  • 19
  • 164
  • 293
Dinesh Kaushik
  • 2,917
  • 2
  • 23
  • 36
  • 1
    for this already has an answer [here] (http://stackoverflow.com/questions/9044735/steps-to-create-and-edit-a-plist-file-in-xcode) – Rugmangathan Oct 30 '13 at 05:37

5 Answers5

35

You can manage the Entitlements in the Capabilities tab of your target settings.

Any change there will automatically update either the Entitlements.plist or the Info.plist file.

That being said, an Entitlements.plist file is in the end just a plist. You can add as much plists as you like following the steps provided in this question.

mfaani
  • 33,269
  • 19
  • 164
  • 293
Gabriele Petronella
  • 106,943
  • 21
  • 217
  • 235
  • 4
    But I want add a new Entitlement.plist There is no option in Capabilities to add a new Entitlement.plist – Dinesh Kaushik Oct 30 '13 at 05:35
  • Thanks for your answer I am working on this , Will let you know if that helped. – Dinesh Kaushik Oct 30 '13 at 05:44
  • I still have the problem happening. It only happens when my app is re-opened via a Deeplink with the following app delegate method: - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url If I just start the app, keychain writing works, and if I minimize and maximize the app, it still works. It's only when I re-open with the deep link that this problem occurs. I do have MyApp.entitlements configured in my project ( Keychain Sharing in the Capabilities tab). – FranticRock Oct 08 '15 at 13:43
  • I think it's not work under iOS16 (beta3) and Xcode Version 14.0 beta 3 (14A5270f), I want to add "com.apple.developer.device-information.user-assigned-device-name" and show device name, it's still not work. – Uthen Jul 18 '22 at 17:06
  • It's work under "apple enterprise account program" ? – Uthen Aug 09 '22 at 01:45
  • @Uthen, have you found any solution for this? – Panadol Chong Dec 13 '22 at 15:17
24

In Xcode 5, for common entitlements you no longer need to create an Entitlements.plist file manually. You use the new Capabilities pane instead. See https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/AppDistributionGuide/AddingCapabilities/AddingCapabilities.html

If you still want to create one manually, here's how:

  1. File menu > New File...
  2. Select iOS > Resource > Property List
  3. Name the new file "foo.entitlements" (typically, "foo" is the target name)
  4. 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)

Don't forget to set your target's CODE_SIGN_ENTITLEMENTS build setting to be the path to entitlements file you just added.

jrc
  • 20,354
  • 10
  • 69
  • 64
11

If you want to add an Entitlement to an existing project in Xcode 5 follow these steps:

  1. Select your project in the Navigator area.
  2. Select your Target in the Editor area.
  3. In the Editor area select the Capabilities option from the menu bar.
  4. Open the disclosure button to the left of the Keychain Sharing option.
  5. Under Keychain Sharing select the "+" button.
  6. Type the entitlement in the input area.
  7. DONE.
pkamb
  • 33,281
  • 23
  • 160
  • 191
duncwa
  • 149
  • 1
  • 7
9

You can manually create an Entitlements.plist file using the template below.

Save it as YourTargetName.entitlements

In your Target > Build Settings, set the key "Code Signing Entitlements" (CODE_SIGN_ENTITLEMENTS) to the file's path.

<?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">
<plist version="1.0">
<dict>
    <key>application-identifier</key>
    <string>$(AppIdentifierPrefix)$(CFBundleIdentifier)</string>
    <key>beta-reports-active</key>
    <true/>
</dict>
</plist>
pkamb
  • 33,281
  • 23
  • 160
  • 191
  • are `$(AppIdentifierPrefix)` and `$(CFBundleIdentifier)` placeholders which one has to replace or are they replaced when the entitlement is parsed by `codesign`? – Eugen Mayer Apr 06 '20 at 15:16
  • @EugenMayer I believe they will be replaced and you can leave them as is. But I'm not positive from when I posted this answer. – pkamb Apr 06 '20 at 20:43
  • Actually the hole String line is no langer needed and will fail if included, just tried ist today – Eugen Mayer Apr 06 '20 at 22:17
-1

CMD + SHIFT + K

to clean the build and rebuild by CMD + B worked for me

Denzel
  • 309
  • 1
  • 8