当前位置: 首页 > news >正文

QT打包Macosx应用发布App Store简易流程

1、QC里编译工程,生成Release版的的app文件;

2、运行macdeployqt把需要的文件打包进app文件中;

% ~/Qt/5.15.0/clang_64/bin/macdeployqt {编译的app文件所在路径}/Release/xxxx.app

3、使用codesign对app进行签名,如果要发App Store的话使用"Mac App Distribution"证书,如果不发的话使用”Developer ID Installer“证书,证书配置在苹果开发者账号苹果证书中创建。

下载证书并安装,结果如下:

3、然后使用codesign对app签名:

% codesign --entitlements {entitlements文件所在目录}/xxxx.entitlements -f -s "3rd Party Mac Developer Application: xxxxxx Co.,Ltd (VQ3IY989UY87)" -v xxxx.app --deep
#运行完结果如下:
xxxx.app: replacing existing signature
xxxx.app: signed app bundle with Mach-O thin (x86_64) [com.xxxx.xxxx] #此处是Bundle Identifier#签名完成

权限文件xxxx.entitlements,可以在xcode的工程里去复制一个,也可以根据需要的权限手工编辑:

检查签名结果:

% codesign -dvvv --entitlements  - xxxx.app
Executable=/这里忽略目录/xxxx.app/Contents/MacOS/xxxx
Identifier=com.xxxx.xxxx
Format=app bundle with Mach-O thin (x86_64)
CodeDirectory v=20400 size=18452 flags=0x0(none) hashes=566+7 location=embedded
Hash type=sha256 size=32
CandidateCDHash sha256=3ed48febdcc36c83hfyuuyt876236f4633bb7b
CandidateCDHashFull sha256=3ed48febdcc36c83a748febdcc36c83hfyuuyt876236f463317fb2f401a8f7a7afaf
Hash choices=sha256
CMSDigest=3ed48febdcc36dcc36c83hfyuuyt876236f46337fb2f401a8f7a7afaf
CMSDigestType=2
CDHash=3ed48febdcc3648dcc36c83hfyuuyt87623332f17236f4633bb7b
Signature size=4854
Authority=3rd Party Mac Developer Application: xxxxxxxxx Co.,Ltd (VQ3IY989UY87)
Authority=Apple Worldwide Developer Relations Certification Authority
Authority=Apple Root CA
Signed Time=Nov 2, 2024 at 01:06:18
Info.plist entries=14
TeamIdentifier=V86876Q87987F
Sealed Resources version=2 rules=13 files=46
Internal requirements count=1 size=232
[Dict][Key] com.apple.developer.usernotifications.communication[Value][Bool] true[Key] com.apple.security.app-sandbox[Value][Bool] true[Key] com.apple.security.files.user-selected.read-only[Value][Bool] true[Key] com.apple.security.files.user-selected.read-write[Value][Bool] true[Key] com.apple.security.network.client[Value][Bool] true[Key] com.apple.security.network.server[Value][Bool] true[Key] com.apple.security.personal-information.photos-library[Value][Bool] true[Key] com.apple.security.print[Value][Bool] true#下部分是权限列表

4、然后打开xxxx.app,找到里面的Info.plist文件编辑内容:

<?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>CFBundleExecutable</key> <!--这个必须要有--><string>xxxx</string><key>CFBundleIconFile</key><string>icon.icns</string><key>CFBundleIdentifier</key> <!--这个必须要有--><string>com.xxxx.xxxx</string><key>CFBundlePackageType</key> <!--这个必须要有--><string>APPL</string><key>CFBundleSignature</key><string>????</string><key>LSMinimumSystemVersion</key><string>10.13</string><key>NOTE</key><string>This file was generated by Qt/QMake.</string><key>NSPrincipalClass</key> <!--这个必须要有--><string>NSApplication</string><key>NSSupportsAutomaticGraphicsSwitching</key><true/><key>CFBundleDisplayName</key> <!--这个尽量要有--><string>我的应用</string><key>CFBundleName</key><string>我的应用</string> <!--这个必须要有--><key>LSApplicationCategoryType</key> <!--这个必须要有--><string>public.app-category.utilities</string><key>CFBundleVersion</key> <!--这个必须要有--><string>100</string><key>CFBundleShortVersionString</key><string>1.0.0</string> <!--这个必须要有--><key>ITSAppUsesNonExemptEncryption</key><false/>
</dict>
</plist>

5、然后,使用productbuild对app进行打包成pkg文件,这里注意使用另外一个安装证书”3rd Party Mac Developer Installer“:

% productbuild --component xxxx.app /Applications/ --sign "3rd Party Mac Developer Installer: xxxxxxxx Co.,Ltd (VQ3IY989UY87)" --product xxxx.app/Contents/Info.plist xxxx.pkgproductbuild: Adding component at /这里省略路径了/Release/智行动力.app
productbuild: Signing product with identity "3rd Party Mac Developer Installer: xxxxxxxx Co.,Ltd (VQ3IY989UY87)" from keychain /Users/hhhhh/Library/Keychains/login.keychain-db
productbuild: Adding certificate "Apple Worldwide Developer Relations Certification Authority"
productbuild: Adding certificate "Apple Root CA"
productbuild: Wrote product to xxxx.pkg
productbuild: Supported OS versions: [Min: 10.13, Before: None]#上面执行完成

6、最后,将生成pkg文件拖拽到Transporter中,看看Transporter上传检查是否出错,如果不出错就可以发布了。

注意:签名证书和产品打包证书是两个;

其余的就,自求多福吧!

http://www.lryc.cn/news/475324.html

相关文章:

  • untiy mlagents 飞机大战 ai训练
  • 从0开始学统计-什么是中心极限定理
  • 工具方法 - 个人活动的分类
  • 11.1组会汇报-基于区块链的安全多方计算研究现状与展望
  • ubuntu【桌面】 配置NAT模式固定IP
  • 评估 机器学习 回归模型 的性能和准确度
  • 如何下载安装TestLink?
  • 基于SSM+微信小程序的订餐管理系统(点餐2)
  • 【C++排序 双指针】1996. 游戏中弱角色的数量|1996
  • GESP4级考试语法知识(捕捉异常)
  • HTML 基础标签——元数据标签 <meta>
  • 栈虚拟机和寄存器虚拟机,有什么不同?
  • Windows下基于fping进行批量IP测试
  • 一款实用的Word文档图片转换与水印保护工具
  • 优化用于传感应用的衬底集成波导技术
  • Java多态特性的向上转型
  • C++ 判断语句的深入解析
  • 15分钟学 Go 第 33 天:项目结构
  • conda迁移虚拟环境路径
  • (八)JavaWeb后端开发——Tomcat
  • yocto中通常不直接修改提供的recipes的bb文件
  • 智能座舱相关术语全解及多模态交互在智能座舱中的应用
  • 【Fastjson反序列化漏洞:深入了解与防范】
  • 【OJ题解】C++实现反转字符串中的每个单词
  • 万字长文详解Hive聚合函数 grouping sets、cube、rollup原理、语法、案例和优化
  • 数列分块入门
  • SPRD Android 14 Launcher 3 中添加长按桌面图标启动自由窗口模式功能
  • WebSocket详解:从前端到后端的全栈理解
  • SOLIDWORKS 2025加快装配体设计 确保可制造性
  • 简单题:计算从位置 x 到 y 的最少步数| 豆包MarsCode AI刷题