Big*_*air 1 ios fastlane firebase-app-distribution
我在 Fastlane Fastfile 中设置了 Firebase 应用分发功能来分发我的 iOS 应用的测试版。它工作正常,但突然开始显示错误。
这就是我的车道的样子。
lane :distribute_beta do |options|
sync_code_signing_adhoc()
update_build_number_of_all_frameworks()
build_ios_app_adhoc()
firebase_app_distribution(
app: "<app ID here>",
testers: "<tester emials here>",
release_notes: options[:release_note],
firebase_cli_path: "/usr/local/bin/firebase"
)
end
Run Code Online (Sandbox Code Playgroud)
当我运行这条车道时,它显示错误
the server responded with status 403
Run Code Online (Sandbox Code Playgroud)
在步骤:firebase_app_distribution
日志还说对谷歌的身份验证成功。
Authenticating with GOOGLE_APPLICATION_CREDENTIALS environment variable: /<path to cred>/<cred_file_name>.json
Authenticated successfully.
Run Code Online (Sandbox Code Playgroud)
以下是围绕“步骤:firebase_app_distribution”的整个错误
[17:11:04]: ---------------------------------------
[17:11:04]: --- Step: firebase_app_distribution ---
[17:11:04]: ---------------------------------------
[17:11:04]: Authenticating with GOOGLE_APPLICATION_CREDENTIALS environment variable: /<path to cred>/<cred_file_name>.json
[17:11:04]: Authenticated successfully.
+------------------------------------+---------------------------------------------+
| Lane Context |
+------------------------------------+---------------------------------------------+
| DEFAULT_PLATFORM | ios |
| PLATFORM_NAME | ios |
| LANE_NAME | ios distribute_beta |
| SIGH_PROFILE_TYPE | ad-hoc |
| MATCH_PROVISIONING_PROFILE_MAPPING | {"<my bndle ID>"=>"match AdHoc |
| | <my bundle ID>"} |
| BUILD_NUMBER | 107 |
| IPA_OUTPUT_PATH | /Users/my_user_name/Repository/App/App|
| | y/App.ipa |
| XCODEBUILD_ARCHIVE | /Users/my_user_name/Library/Developer/Xcode/A|
| | rchives/2021-01-08/App 2021-01-08 |
| | 17.09.08.xcarchive |
| DSYM_OUTPUT_PATH | /Users/my_user_name/Repository/App/App |
| | y/App.app.dSYM.zip |
+------------------------------------+---------------------------------------------+
[17:11:06]: the server responded with status 403
+------+-----------------------------+-------------+
| fastlane summary |
+------+-----------------------------+-------------+
| Step | Action | Time (in s) |
+------+-----------------------------+-------------+
| 1 | default_platform | 0 |
| 2 | Switch to ios | 0 |
| | sync_code_signing_adhoc | |
| | lane | |
| 3 | sync_code_signing | 18 |
| 4 | Switch to ios | 0 |
| | update_build_number_of_all | |
| | _frameworks lane | |
| 5 | increment_build_number | 1 |
| 6 | commit_version_bump | 0 |
| 7 | Switch to ios | 0 |
| | build_ios_app_adhoc lane | |
| 8 | build_ios_app | 126 |
| | firebase_app_distribution | 1 |
+------+-----------------------------+-------------+
[17:11:06]: fastlane finished with errors
Run Code Online (Sandbox Code Playgroud)
我怎样才能解决这个问题?
对于我来说,这是因为我使用的服务帐户没有Firebase App Distribution Admin角色。https://firebase.google.com/docs/app-distribution/authenticate-service-account?platform=ios
我只需编辑现有服务,为此,请转到 Firebase 控制台 > 项目设置 > 服务帐户 > 然后单击服务帐户,如下图所示
它将带您进入 GCP IAM 和管理,您可以在其中查找和编辑服务帐户的角色。
通常,当您收到该特定消息时,意味着 Firebase 刷新令牌不再有效。
因此,当您提交应用程序时,在某些时候,您必须指定 Firebase 刷新令牌:
...
firebase_app_distrubution(
...
firebase_cli_token: "<YourFirebaseRefreshToken>"
)
...
Run Code Online (Sandbox Code Playgroud)
您可以从此处获取此令牌。如果您的脚本开始突然失败,这可能意味着生成此(或任何其他身份验证令牌)的人已从 Firebase 项目中删除。
如果您收到403,那肯定意味着有人从您的 Firebase 项目中删除,或者有人在 Firebase 控制台上删除/重新生成了令牌。
只需在控制台上运行以下命令:
\ncurl -sL https://firebase.tools | bash\nRun Code Online (Sandbox Code Playgroud)\n然后在浏览器上进行身份验证
\n然后运行
\nfirebase login:ci\nRun Code Online (Sandbox Code Playgroud)\n成功后,您将打印新的 cli 令牌,如下所示:
\n\n等待身份验证...\n\n\xe2\x9c\x94 成功!使用此令牌登录 CI 服务器:\n\n1//here_will_be_your_new_token\n\n示例:firebase deploy --token "$FIREBASE_TOKEN"\n