上传到 TestFlight 时 Fastlane 失败

问题描述

我有一个简单的 fastlane 命令,如下所示。

  desc "Push a new beta build to TestFlight"
  lane :beta do
    build_app(workspace: "Project.xcworkspace",scheme: "Project")
    upload_to_testflight
  end

它成功完成了存档。但在上传过程中崩溃并显示以下日志:

[11:24:38]: ▸ ** ARCHIVE SUCCEEDED **
[11:24:38]: 
[11:24:38]: ⬆️  Check out the few lines of raw `xcodebuild` output above for potential hints on how to solve this error
[11:24:38]: ?  For the complete and more detailed error log,check the full log at:
[11:24:38]: ?  /Users/user/Library/Logs/gym/project.log
[11:24:38]: 
[11:24:38]: Looks like fastlane ran into a build/archive error with your project
[11:24:38]: It's hard to tell what's causing the error,so we wrote some guides on how
[11:24:38]: to troubleshoot build and signing issues: https://docs.fastlane.tools/codesigning/getting-started/
[11:24:38]: Before submitting an issue on GitHub,please follow the guide above and make
[11:24:38]: sure your project is set up correctly.
[11:24:38]: fastlane uses `xcodebuild` commands to generate your binary,you can see the
[11:24:38]: the full commands printed out in yellow in the above log.
[11:24:38]: Make sure to inspect the output above,as usually you'll find more error information there
[11:24:38]: 
[11:24:38]: Looks like no provisioning profile mapping was provided
[11:24:38]: Please check the complete output,in particular the very top
[11:24:38]: and see if you can find more information. You can also run fastlane
[11:24:38]: with the `--verbose` flag.
[11:24:38]: Alternatively you can provide the provisioning profile mapping manually
[11:24:38]: https://docs.fastlane.tools/codesigning/xcode-project/#xcode-9-and-up
+------------------+-----------+
|         Lane Context         |
+------------------+-----------+
| DEFAULT_PLATFORM | ios       |
| PLATFORM_NAME    | ios       |
| LANE_NAME        | ios tests |
| BUILD_NUMBER     | 4         |
+------------------+-----------+
[11:24:38]: Error packaging up the application

+------+------------------------+-------------+
|              fastlane summary               |
+------+------------------------+-------------+
| Step | Action                 | Time (in s) |
+------+------------------------+-------------+
| 1    | default_platform       | 0           |
| 2    | increment_build_number | 2           |
| ?   | build_app              | 742         |
+------+------------------------+-------------+

[11:24:38]: fastlane finished with errors

[!] Error packaging up the application

解决方法

我意识到当我尝试手动上传应用程序时,Xcode 会引发与权限相关的异常。我当前的个人资料具有 developer 角色,验证并上传到 TestFlight 需要 admin 角色。我更改了配置文件,Fastlane 成功完成。