使用Shorebird+CodeMagic构建iOS应用失败:找不到签名配置文件
问题描述
在CodeMagic中使用Shorebird的shorebird release ios-alpha/shorebird patch ios-alpha命令构建iOS应用时失败,错误提示:
No Accounts No profiles for 'x.x.x' were found
此前不使用Shorebird时,CodeMagic流程可正常完成签名和发布。
解决方案
1. 验证Shorebird Flutter版本一致性
在Shorebird构建命令前添加版本验证,确保与项目配置的Flutter版本完全匹配:
shorebird flutter --version
确认输出版本与你配置的flutter: 3.10.6一致,若有偏差重新执行shorebird flutter versions use 3.10.6。
2. 显式传递签名参数给Shorebird
Shorebird的iOS alpha版本未自动继承CodeMagic的签名配置,需手动指定:
- 在CodeMagic环境变量中添加
BUNDLE_ID,值为你的应用Bundle ID - 修改Shorebird构建脚本,添加签名参数:
# 获取Provisioning Profile路径 PROFILE_PATH=$(find ~/Library/MobileDevice/Provisioning\ Profiles -name "*.mobileprovision" | grep "For CodeMagic") # 解锁Keychain确保Shorebird可访问证书 security unlock-keychain -p $CM_KEYCHAIN_PASSWORD $CM_KEYCHAIN_PATH if [ "$TYPE" == *"#"* ]; then echo "🩹 Running patch command" shorebird patch ios-alpha --force --bundle-id $BUNDLE_ID --provisioning-profile "$PROFILE_PATH" else echo "🚀 Running release command" shorebird release ios-alpha --force --bundle-id $BUNDLE_ID --provisioning-profile "$PROFILE_PATH" fi
3. 验证Provisioning Profile有效性
在脚本中添加验证命令,确认Profile与Bundle ID匹配:
security cms -D -i "$PROFILE_PATH" | grep -A 10 "Entitlements"
检查输出的application-identifier是否与你的BUNDLE_ID完全一致,若不一致需重新配置CodeMagic中的Provisioning Profile。
4. 直接传递Xcode签名参数
若上述方法无效,通过--xcode-args直接传递Xcode签名参数:
shorebird release ios-alpha --force --xcode-args "-allowProvisioningUpdates -signingCertificate 'iPhone Distribution: 你的团队名称' -provisioningProfile 'For CodeMagic'"
替换签名证书名称和Provisioning Profile名称为你在CodeMagic中配置的内容。
内容的提问来源于stack exchange,提问作者Muhammed Furkan Yüceal
相关产品推荐
相关产品推荐

