ios - 找不到代码签名身份并且无法创建新身份,因为您启用了 `readonly`

标签 ios fastlane

当我使用 faSTLane 在 github 中发布 ios 应用程序时:

- name: Deploy to TestFlight/PGY
        run: |
          cd ./ios
          bundle exec fastlane beta
        env:
          FLUTTER_ROOT: ${{ secrets.FLUTTER_ROOT }}
          APPLE_ID: ${{ secrets.APPLE_ID }}
          GIT_URL: ${{ secrets.GIT_URL }}
          PGY_USER_KEY: ${{ secrets.PGY_USER_KEY }}
          PGY_API_KEY: ${{ secrets.PGY_API_KEY }}
          TEAM_ID: ${{ secrets.TEAM_ID }}
          ITC_TEAM_ID: ${{ secrets.ITC_TEAM_ID }}
          FASTLANE_USER: ${{ secrets.FASTLANE_USER }}
          FASTLANE_PASSWORD: ${{ secrets.FASTLANE_PASSWORD }}
          FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD: ${{ secrets.FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD }}
          FASTLANE_SESSION: ${{ secrets.FASTLANE_SESSION }}
          MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
          MATCH_KEYCHAIN_NAME: ${{ secrets.MATCH_KEYCHAIN_NAME }}
          MATCH_KEYCHAIN_PASSWORD: ${{ secrets.MATCH_KEYCHAIN_PASSWORD }}

显示此错误:

No code signing identity found and can not create a new one because you enabled `readonly`

这是日志的一部分:

+-----------------------+---------+--------+
|               Used plugins               |
+-----------------------+---------+--------+
| Plugin                | Version | Action |
+-----------------------+---------+--------+
| fastlane-plugin-pgyer | 0.2.2   | pgyer  |
+-----------------------+---------+--------+

[14:58:29]: Sending anonymous analytics information
[14:58:29]: Learn more at https://docs.fastlane.tools/#metrics
[14:58:29]: No personal or sensitive data is sent.
[14:58:29]: You can disable this by adding `opt_out_usage` at the top of your Fastfile
[14:58:29]: ------------------------------
[14:58:29]: --- Step: default_platform ---
[14:58:29]: ------------------------------
[14:58:29]: Driving the lane 'ios beta' 🚀
[14:58:29]: --------------------------
[14:58:29]: --- Step: xcode_select ---
[14:58:29]: --------------------------
[14:58:29]: Setting Xcode version to /Applications/Xcode_12.4.app for all build steps
[14:58:29]: -----------------------------
[14:58:29]: --- Step: create_keychain ---
[14:58:29]: -----------------------------
[14:58:29]: Found keychain '~/Library/Keychains/***', creation skipped
[14:58:29]: If creating a new Keychain DB is required please set the `require_create` option true to cause the action to fail
[14:58:29]: $ security list-keychains -d user
[14:58:29]: ▸ "/Users/runner/Library/Keychains/***-db"
[14:58:29]: Found keychain '/Users/runner/Library/Keychains/***-db' in list-keychains, adding to search list skipped
[14:58:29]: -------------------
[14:58:29]: --- Step: is_ci ---
[14:58:29]: -------------------
[14:58:30]: -------------------
[14:58:30]: --- Step: match ---
[14:58:30]: -------------------
[14:58:30]: Successfully loaded '/Users/runner/work/flutter-netease-music/flutter-netease-music/ios/fastlane/Matchfile' 📄

+----------------+-----------------------------------------------------------------------------------------------------------------+
|                                           Detected Values from './fastlane/Matchfile'                                            |
+----------------+-----------------------------------------------------------------------------------------------------------------+
| git_url        | *** |
| git_branch     | master                                                                                                          |
| storage_mode   | git                                                                                                             |
| type           | adhoc                                                                                                           |
| app_identifier | ["com.reddwarf.musicapp"]                                                                                       |
| username       | ***                                                                                                |
+----------------+-----------------------------------------------------------------------------------------------------------------+


+--------------------------------+-----------------------------------------------------------------------------------------------------------------+
|                                                            Summary for match 2.191.0                                                             |
+--------------------------------+-----------------------------------------------------------------------------------------------------------------+
| app_identifier                 | ["com.reddwarf.musicapp"]                                                                                       |
| git_url                        | *** |
| type                           | adhoc                                                                                                           |
| readonly                       | true                                                                                                            |
| keychain_name                  | ***                                                                                                  |
| generate_apple_certs           | true                                                                                                            |
| skip_provisioning_profiles     | false                                                                                                           |
| username                       | ***                                                                                                |
| team_id                        | ***                                                                                                      |
| storage_mode                   | git                                                                                                             |
| git_branch                     | master                                                                                                          |
| shallow_clone                  | false                                                                                                           |
| clone_branch_directly          | false                                                                                                           |
| force                          | false                                                                                                           |
| force_for_new_devices          | false                                                                                                           |
| skip_confirmation              | false                                                                                                           |
| skip_docs                      | false                                                                                                           |
| platform                       | ios                                                                                                             |
| derive_catalyst_app_identifier | false                                                                                                           |
| fail_on_name_taken             | false                                                                                                           |
| skip_certificate_matching      | false                                                                                                           |
| skip_set_partition_list        | false                                                                                                           |
| verbose                        | false                                                                                                           |
+--------------------------------+-----------------------------------------------------------------------------------------------------------------+

[14:58:30]: Cloning remote git repo...
[14:58:30]: If cloning the repo takes too long, you can use the `clone_branch_directly` option in match.
[14:58:30]: Checking out branch master...
[14:58:30]: 🔓  Successfully decrypted certificates repo
[14:58:30]: Couldn't find a valid code signing identity for distribution... creating one for you now
+---------------------------+-----------------------------------------------------+
|                                  Lane Context                                   |
+---------------------------+-----------------------------------------------------+
| DEFAULT_PLATFORM          | ios                                                 |
| PLATFORM_NAME             | ios                                                 |
| LANE_NAME                 | ios beta                                            |
| KEYCHAIN_PATH             | ~/Library/Keychains/***                  |
| ORIGINAL_DEFAULT_KEYCHAIN | "/Users/runner/Library/Keychains/***-db" |
+---------------------------+-----------------------------------------------------+
[14:58:30]: No code signing identity found and can not create a new one because you enabled `readonly`

+------+------------------+-------------+
|           fastlane summary            |
+------+------------------+-------------+
| Step | Action           | Time (in s) |
+------+------------------+-------------+
| 1    | default_platform | 0           |
| 2    | xcode_select     | 0           |
| 3    | create_keychain  | 0           |
| 4    | is_ci            | 0           |
| 💥   | match            | 0           |
+------+------------------+-------------+

[14:58:30]: fastlane finished with errors

我应该怎么做才能解决这个问题?

最佳答案

我看到 is_ci 也运行了。您的 match 命令是否如下所示: match(.., readonly: is_ci, ...) 并且您是在 Jenkins 或其他某个 CI 服务上运行命令吗? 如果是这样,请先在本地运行它,这将生成所需的所有相关证书和配置文件。然后再次在您的 CI 服务上运行它。

关于ios - 找不到代码签名身份并且无法创建新身份,因为您启用了 `readonly`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68820080/

相关文章:

xcode - faSTLane 创建的 .cer 和 .mobileprovision 文件应该存储在 git 中吗?

ios - uitableview 返回 2 cellIdentifier

faSTLane - 尽管 Google Play 商店显示不同,但 APK 版本代码冲突

ios - 导航离开并返回后 ViewController 为空白

ios - Swift iOS -Constraint 即使调用了 view.layoutIfNeeded() 也没有动画

ios - `xcconfig` 文件中的条件用户定义变量

ios - 如何获取 iTunes 连接团队 ID 和团队名称?

ios - FaSTLane Gym 配置 Ad Hoc Distribution

ios - 让应用程序在越狱设备上自行重启

ios - 运行应用程序时出错 : "Item Not Available"