App Sandbox capability missing in Xcode project
Asked Answered
M

3

14

According to this guide, there should be an App Sandbox capability in the project file:

enter image description here

However, for some reason my app project does not have any App Sandbox capability that I can turn on:

enter image description here

Why is it missing, and how can I get it there?

Moldavia answered 25/3, 2019 at 20:51 Comment(1)
Appstore-Sandbox is for Mac OS X Apps. In iOS the sandbox is always turned on and can't be configured. What are you trying to configure?Ceylon
S
24

First of all, you should open the ***.entitlements file. In this file, add a Key named App Sandbox and changed Value to YES.

After completing the above steps, click command + b then go back to Signing & Capabilities, the App Sandbox will appear.

Southard answered 13/11, 2019 at 9:11 Comment(3)
this answer works but it will take a 5 -10 minutes before it appearsCapful
I can't find this file when the project was created, what can I do?Rawley
It doesn't appear thoBotzow
F
6

Add missing App Sandbox capability in Xcode

(Straightforward to do but a pain to remember.)

  1. If your project lacks a .entitlements file, create a new one:
  • Menu: View > Navigators > Project
  • Select the root level (project icon) of your project
  • Menu: File > New > File...
  • Use the Property List template
  • Name the file after your project. Example: MYPROJECT.entitlements.
  1. Edit the file:
  • Select the file in the Project navigator sidebar.

  • Add a new row (via the (+) symbol, just as you would for a .plist file.)

    key: App Sandbox type: Boolean value: YES

    This is the same as editing the source code (file contents) to be:

    <?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>com.apple.security.app-sandbox</key>
        <true/>
    </dict>
    </plist>
    
    
  1. Register this new file in the built target settings for your project.
  • Menu: View > Navigators > Project

  • Select the root level (project icon) of your project

  • In the project and targets list (left sidebar within the editor), select the target under TARGETS (not the Project)

  • In the editor area, select the Build Settings tab

  • Select All (show all build settings), not Basic

  • In the list, find CODE_SIGN_ENTITLEMENTS

  • Set its value to the location of the .entitlements file. If you created it at the root level of the project, this is just the filename, otherwise the relative folder path.

    Example: butterflies.entitlements Example: butterflies/butterflies.entitlements

I recommend then doing a Clean Build Folder, select a suitable build platform and doing a Product Build or Run.

Caveat: App Sandbox can be missing for other reasons but this is the most common one I come across.

Footfall answered 24/11, 2022 at 12:45 Comment(0)
M
4

If your Apple provisioning profile is missing the App Sandbox entitlement then it won't show up in xcode.

FYI - you can add manually to entitlement file, however it wont let you build unless described in your provisioning profile. Same goes for ditribution as well.

To Add entitlement > Open *.entitlements file as source code > add the following code.

<key>App Sandbox</key> <true/>

You can regenerate the provisioning profile with the desired capabilities, if you are the admin/team agent of the Apple store project.

hope this helps.

Maggiore answered 24/12, 2019 at 18:30 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.