
问题描述
上传pkg文件到App Store,出现错误提示The following executables must include the "com.apple.security.app-sandbox" entitlement with a Boolean value of true in the entitlements property list
.

问题原因
pkg文件中包含一个未签名的可执行文件,导致上传App Store时报错。
解决方案
假设你的可执行文件是”myexe”
1.创建myexe.entitlements
文件
1 | <?xml version="1.0" encoding="UTF-8"?> |
2.执行命令行
1 | codesign -f -s "$YOUR_CERTIFICATE_HERE" --entitlements "$THE_ENTITLEMENTS_PLIST" "$THE_EXECUTABLE" |
$YOUR_CERTIFICATE_HERE
使用你电脑上的 3rd Party Mac Developer Application certificate$THE_ENTITLEMENTS_PLIST
是myexe.entitlements
文件绝对路径$THE_EXECUTABLE
是工程中可执行文件的绝对路径
以下列一个自己执行的命令行:
1 | codesign -f -s "3rd Party Mac Developer Application: xxxx (xxx)" --entitlements "/Users/xxx/Documents/xxx/myexe.entitlements" "/Users/xxx/Documents/xxx/myexe" |
查看可执行文件内部签名的命令
1 | ➜ codesign -d -vvv --entitlements :- aria2c |
参考链接
How can I code sign a bundled executable file in a mac app using xcode5
Error when trying to Sandbox with codesign command
对于 Mac 应用程序在使用 3rd 方应用程序开发人员证书进行签名时验证应用程序时出错:未启用应用程序沙箱。以下可执行文件必须包含布尔值为 t 的“com.apple.security.app-sandbox”权利
Embedding a Command-Line Tool in a Sandboxed App
Embedding Nonstandard Code Structures in a Bundle