macOS APP 打包签名公证

打包

由于 APP 是使用 python 开发,所以就使用 pyinstaller 打包

pyinstaller --paths ./src --windowed --icon ./name.icns --osx-bundle-identifier "" ./name.spec --add-data="./name.zip:."

签名

codesign --deep -s "Developer ID Application: ***" ./name.app

构建 pkg 及 installer 签名

productbuild  --sign "Developer ID Installer: ***" --distribution Distribution.xml --package-path pkg --resources resources ./name.pkg

转换 dmg

hdiutil create -srcfolder ./name.pkg  -volname "name" ./name.dmg

公证

苹果的公告,2020年2月(可能会推迟)以后未公证或者上架的 APP 禁止在10.15.2以后的系统运行

xcrun altool --notarize-app -itc_provider "Team id" --primary-bundle-id "bundle-id" --username "username" --password "password" --file ./name.dmg

上传成功后会输出

No errors uploading 'name.dmg'
RequestUUID = *******-*******-*******-*******-*******

然后用 xcrun stapler staple name.dmg 盖章

输出 The staple and validate action worked! 就表示成功了

其中的name.** 根据自己的应用名或路径修改


macOS备忘录

195 字

2020-01-23 01:42 +0900

2020-01-23 01:42 +0900

comments powered by Disqus