0%

ERROR ITMS-90296问题修复

问题描述

上传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
2
3
4
5
6
7
8
9
10
11
12
<?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/>
<key>com.apple.security.files.user-selected.read-write</key>
<true/>
</dict>
</plist>

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_PLISTmyexe.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
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
➜ codesign -d -vvv --entitlements :- aria2c
Executable=/Users/tingyue/Desktop/111/aria2c
Identifier=aria2c
Format=Mach-O thin (arm64)
CodeDirectory v=20400 size=37087 flags=0x20002(adhoc,linker-signed) hashes=1156+0 location=embedded
Hash type=sha256 size=32
CandidateCDHash sha256=bc0e6a53312c4313d8bcc993327d7db6bf38bc42
CandidateCDHashFull sha256=bc0e6a53312c4313d8bcc993327d7db6bf38bc4278628d1367def2a85e06cda2
Hash choices=sha256
CMSDigest=bc0e6a53312c4313d8bcc993327d7db6bf38bc4278628d1367def2a85e06cda2
CMSDigestType=2
CDHash=bc0e6a53312c4313d8bcc993327d7db6bf38bc42
Signature=adhoc
Info.plist=not bound
TeamIdentifier=not set
Sealed Resources=none
Internal requirements=none

参考链接

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