My app utilizes a custom build of sqlite3 (shell) to do some tasks. I have a copy file phase in project Build Settings to copy it along with a tool.sh script into Frameworks destination. The relevant code works during debugging. However when I submit the app for review, I got an email that says:
App sandbox not enabled - The following executables must include the "com.apple.security.app-sandbox" entitlement with a Boolean value of true in the entitlements property list. Refer to the App Sandbox page for more information on sandboxing your app.
net.neolib.BingDailyWallpaper.pkg/Payload/Daily Wallpaper Changer for Bing.app/Contents/Frameworks/sqlite3
I wonder why it needs an entitlement. But I have to workaround this problem. Any suggestions will be appreciated.
The following is for Xcode 7.3.1:
Create
project.MyApp
In the project build settings, set Strip Debug Symbols During Copy (
) to No.COPY_PHASE_STRIP
Set up the
target’s code signing in the usual way:MyApp
set Signing and Team ID in the General tab
enable App Sandbox via the Capabilities tab
Create a
target within theMyTool
project.MyApp
In the
group, create a property list file calledMyTool
.MyTool.entitlements
In that file, add to entries:
com.apple.security.app-sandbox
com.apple.security.inherit
both as Booleans with the value set to YES.
IMPORTANT Do not add the file to any targets.
In the
build settings, set Code Signing Entitlements (MyTool
) toCODE_SIGN_ENTITLEMENTS
.MyTool/MyTool.entitlements
Build the tool.
In the
target, create a custom Copy Files build phase and:MyApp
set Destination to Executables
add MyTool to the list of items to copy
make sure Code Sign On Copy is checked
Build the app.
Now check the entitlements of each item. First, the tool before it was copied into the app.
$ codesign -d --entitlements :- build/Debug/MyTool Executable=/Users/quinn/Desktop/MyApp/build/Debug/MyTool <?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/> <key>com.apple.security.inherit</key> <true/> </dict> </plist>
Next, the tool within the app.
$ codesign -d --entitlements :- build/Debug/MyApp.app/Contents/MacOS/MyTool Executable=/Users/quinn/Desktop/MyApp/build/Debug/MyApp.app/Contents/MacOS/MyTool <?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/> <key>com.apple.security.inherit</key> <true/> </dict> </plist>
Finally, the app itself.
$ codesign -d --entitlements :- build/Debug/MyApp.app Executable=/Users/quinn/Desktop/MyApp/build/Debug/MyApp.app/Contents/MacOS/MyApp <?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>
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"