Electron Forge osxNotarize执行notarytool submit时卡住求助
Electron 应用公证卡在「Finalizing Package」的排查方案
排查方向及解决步骤
网络连接优化
Apple公证服务器位于海外,不稳定的网络会导致上传超时或卡住:- 切换到能稳定访问海外服务的网络环境,确保
xcrun notarytool可正常连接Apple服务器。 - 检查本地防火墙、代理规则,确认该命令未被拦截。
- 切换到能稳定访问海外服务的网络环境,确保
更新Xcode命令行工具
旧版本工具可能存在兼容性或大文件上传缺陷:- 执行
xcode-select --install更新至最新版本。 - 运行
xcrun notarytool --version确认版本,建议使用Xcode 13及以上配套的notarytool。
- 执行
调整超时参数
0.3GB的包上传需要更长时间,默认超时可能不足:
手动执行命令时添加超时参数(单位:秒):xcrun notarytool submit /var/folders/4g/p6tq8s_j4tqf78675mcggp8m0000gn/T/electron-notarize-TYQUzu/MYAPP.zip \ --apple-id ********* \ --password ********* \ --team-id ********* \ --wait \ --output-format json \ --timeout 3600若使用Forge配置,可在
osxNotarize中添加timeout字段:osxNotarize: { tool: 'notarytool', appleId: process.env.APPLE_ID, appleIdPassword: process.env.APP_SPECIFIC_PASSWORD, teamId: process.env.APPLE_TEAM_ID, timeout: 3600 }验证凭证与权限
- 确认App专用密码正确,且该密码关联的Apple ID拥有Developer ID公证权限,可重新生成专用密码尝试。
- 检查Team ID与签名用的Developer ID证书所属团队完全匹配。
重新生成合规压缩包
第三方压缩工具可能导致包格式不符合Apple要求:
使用Apple推荐的命令重新压缩应用:ditto -c -k --sequesterRsrc --keepParent /path/to/YourSignedApp.app /path/to/MYAPP.zip解压验证包完整性,确保应用能正常启动。
改用异步提交排查
去掉--wait参数,先提交任务再查询状态,排除等待阶段的异常:- 提交任务:
xcrun notarytool submit /path/to/MYAPP.zip \ --apple-id ********* \ --password ********* \ --team-id ********* \ --output-format json- 获取返回的
submissionId,查询公证状态:
xcrun notarytool log <SUBMISSION_ID> \ --apple-id ********* \ --password ********* \ --team-id *********
内容的提问来源于stack exchange,提问作者Oliver Barnum
相关产品推荐
相关产品推荐

