Electron Builder应用签名失败:Apple开发者账号授权错误求助
Apple公证上传授权失败(Error Code -19000)的排查方案
问题描述
此前运行正常的构建脚本,近一周无明显诱因失败,在上传资源至Apple服务器进行公证前,开发者账号授权失败,具体错误日志如下:
• notarization successful ⨯ Failed to upload app to Apple's notarization servers 2023-06-12 21:34:55.078 *** Error: Notarization failed for '/var/folders/46/2g56kmkj5vg088rg986v50y00000gn/T/electron-notarize-XOnl0H/MyElectronApp.zip'. 322023-06-12 21:34:55.079 *** Error: Unable to upload your app for notarization. Failed to get authorization for username <redacted-email> and password. ( 33 "Error Domain=ITunesConnectionOperationErrorDomain Code=-19000 \"Sign in with the app-specific password you generated. If you forgot the app-specific password or need to create a new one, go to appleid.apple.com\" UserInfo={NSLocalizedRecoverySuggestion=Sign in with the app-specific password you generated. If you forgot the app-specific password or need to create a new one, go to appleid.apple.com, NSLocalizedDescription=Sign in with the app-specific password you generated. If you forgot the app-specific password or need to create a new one, go to appleid.apple.com, NSLocalizedFailureReason=Apple Services operation failed.}" 34) (-1011) 35 { 36 NSLocalizedDescription = "Unable to upload your app for notarization."; 37 NSLocalizedFailureReason = "Failed to get authorization for username <redacted-email> and password. (\n \"Error Domain=ITunesConnectionOperationErrorDomain Code=-19000 \\\"Sign in with the app-specific password you generated. If you forgot the app-specific password or need to create a new one, go to appleid.apple.com\\\" UserInfo={NSLocalizedRecoverySuggestion=Sign in with the app-specific password you generated. If you forgot the app-specific password or need to create a new one, go to appleid.apple.com, NSLocalizedDescription=Sign in with the app-specific password you generated. If you forgot the app-specific password or need to create a new one, go to appleid.apple.com, NSLocalizedFailureReason=Apple Services operation failed.}\"\n)"; 38}
已尝试的排查步骤:
- 重新生成应用专用密码两次
- 确认Apple开发者服务状态正常
- 间隔数小时重试构建(以往有效但此次无效)
- 验证开发者证书均有效
额外排查/解决方案
检查专用密码的权限范围
生成应用专用密码时,确保选择与「App Store Connect」相关的权限分类,避免选择iCloud等其他服务权限,权限不匹配会直接导致授权失败。清理本地钥匙串缓存凭据
本地钥匙串可能缓存了旧的账号凭据或无效密码,导致构建脚本读取错误信息:- 打开「钥匙串访问」,搜索该Apple ID相关条目(包括
altool、notarytool的关联凭据) - 删除所有匹配的旧密码条目后,重新在构建脚本中配置新生成的专用密码
- 打开「钥匙串访问」,搜索该Apple ID相关条目(包括
替换为
notarytool工具
Apple已逐步弃用altool,notarytool的授权流程更稳定,若脚本仍使用altool,建议替换:- 示例命令:
xcrun notarytool submit MyElectronApp.zip --apple-id <你的邮箱> --password <应用专用密码> --team-id <你的团队ID> --wait
- 示例命令:
验证账号状态与双重认证
- 登录Apple ID管理页面,确认账号未被锁定、双重认证正常启用
- 若近期修改过账号密码或双重认证设置,重新生成一次应用专用密码
排查网络环境限制
- 确认构建机器的网络未通过代理、防火墙拦截Apple公证服务器请求(涉及
*.apple.com、*.itunes.apple.com等域名) - 尝试切换网络环境(如手机热点)重试,排除企业网络规则限制
- 确认构建机器的网络未通过代理、防火墙拦截Apple公证服务器请求(涉及
确认团队ID匹配
构建脚本中使用的团队ID必须与Apple ID所属的开发者团队一致:- 登录App Store Connect核对团队ID
- 在脚本中明确指定
--team-id(notarytool)或--asc-provider(altool)参数
内容的提问来源于stack exchange,提问作者nsrCodes
相关产品推荐
相关产品推荐

