1. 签名程序获取(联系邮箱:peter_mao_studio@163.com)
2.程序使用说明
- 签名的app 必须是标准的苹果应用形式,请自行查阅相关文档
- 若运行时提示未知开发者以及损害等提示,在设置中继续允许运行即可
- 程序改编自Qt源码,无任何风险
- 程序使用示例 :
./Codesign /~/Desktop/xxx.app -sign-for-notarization="开发者id 或苹果商店上架id"
- 若应用包含权利文件(必须以 .entitlements 格式放置在
xxx.app/Contents/Resources
目录下),即可使用相应权利进行签名 - 替换签名,以及签名错误均会有相关提示,请根据相关提示进行修改
- -hardened-runtime 在签名时会加上 -o runtime 进行签名
- -timestamp 选项选择 必须具有网络连接,如连接timestamp服务器错误,则应用需要重新签名,无可避免
- -sign-for-notarization 会同时 带上-hardened-runtime -timestamp ,无需额外的选项
- 签名时建议备份应用,签名失败导致的异常可能会导致下次签名直接失败,如出现该情况,请对原始应用进行重新签名尝试
Usage: Codesign app-bundle [options]
Options:
-codesign=<ident> : Run codesign with the given identity on all executables
-hardened-runtime : Enable Hardened Runtime when code signing
-timestamp : Include a secure timestamp when code signing (requires internet connection)
-sign-for-notarization=<ident>: Activate the necessary options for notarization (requires internet connection)
3.对app进行公证及盖章
- 将应用压缩为zip,使用如下命令,不建议使用右键压缩(会附带苹果其他文件)
ditto -c -k --keepParent "签名后的app 路径" "xxx.zip
- 准备应用专属密码,开发者账号、密码、组织10位id,详情见苹果开发文档
- 存储keychain-profile 使用该命令,根据屏幕提示完成
xcrun notarytool store-credentials
,如已存储,请跳过该步骤 - 上传zip进行公证
xcrun notarytool submit “zip文件” --wait --keychain-profile "上述的keychain-profile"
- 等待公证结果,如遇网络问题,显示无法找到domain 等请选择其他时间进行尝试
- 如结果为rejected,请使用命令
xcrun notarytool log “公证时显示在终端审核id” --keychain-profile "上述的keychain-profile" developer_log.json
对存储的log.json文件根据相关提示进行修改;若结果为accepted,请对签名后的app进行盖章xcrun stapler staple “签名后的app路径”
4. 通过自己的方式生成dmg\pkg 如create-dmg ,appdmg等
5. 对dmg进行签名
codesign -s "开发者id\ 苹果上架id" "所需签名的dmg"
验证dmg签名
codesign --verify --deep --verbose=2 --strict "签名的dmg"