由于Mac上打包发布流程比较复杂,特意写篇文章记录下来:
一、给app的相关动态库签名
进入到app里面,存放动态库的文件夹内,对所有动态库进行签名:
codesign --force --verify --verbose --sign "Developer ID Application: xxxxx (Gxxxxx)" *
对单个动态库签名:
codesign --force --verify --verbose --sign "Developer ID Application: xxxxx (Gxxxxx)" aaa.dylib
二、给app用到的第三方软件签名和APP自己签名
codesign -fs "Developer ID Application: xxxx (Gxxx)" --options=runtime --timestamp -v --deep myapp.app
三、查看签名
四、把app压缩成zip,用来进行公证(*注意:如果用系统自带的进行压缩,可能添加其它文件,导致公证失败)
ditto -c -k --keepParent test.app test.app.zip.
五、提交压缩包进行公证
xcrun notarytool submit ./test.zip --apple-id "xxx@163.com" --team-id "Gxxx" --password "xxxx-xxxx-xxxx-xxxx" -v -f "json"
六、查看公证结果
xcrun notarytool log "2b4a8d90-05a7-4146-ad7c-0286a53b0538" --apple-id "xxxx@163.com" --password "xxxx-xxxx-xxxx-xxxx" --team-id "Gxxxxxxxxx"
七、添加票据
sudo xcrun stapler staple app.pkg
八、验证票据是否添加成功
xcrun stapler validate app.pkg
九、整体验证
spctl --assess -vv --type install app.pkg
十、QT打包修改包路径
//查看程序或库所依赖的库
otool -L 程序路径
//修改程序或库所依赖的路径
install_name_tool -change "原始路径" "新路径" 目标路径