How to create Entitlement.plist file in Xcode?
Asked Answered
G

5

36

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.

Graptolite answered 30/10, 2013 at 5:28 Comment(1)
for this already has an answer [here] (#9045235)Irresolution
T
37

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.

Trapes answered 30/10, 2013 at 5:33 Comment(6)
But I want add a new Entitlement.plist There is no option in Capabilities to add a new Entitlement.plistGraptolite
Thanks for your answer I am working on this , Will let you know if that helped.Graptolite
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).Citreous
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.Peerless
It's work under "apple enterprise account program" ?Peerless
@Uthen, have you found any solution for this?Decode
A
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.

Aflcio answered 4/2, 2014 at 17:28 Comment(0)
R
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.
Ritualism answered 23/1, 2014 at 21:0 Comment(1)
Thanks!!!! After much and much and much searching, this helped! For noobs like me, the disclosure button was a + button next to the word capabilities.Volunteer
N
10

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>
Nicollenicolson answered 12/3, 2015 at 0:8 Comment(3)
are $(AppIdentifierPrefix) and $(CFBundleIdentifier) placeholders which one has to replace or are they replaced when the entitlement is parsed by codesign?Bookcraft
@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.Nicollenicolson
Actually the hole String line is no langer needed and will fail if included, just tried ist todayBookcraft
L
-2

CMD + SHIFT + K

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

Lexi answered 11/12, 2020 at 7:29 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.