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

How to get iTunes connect Team ID and Team name?

我正在为 fastlane 写下 Appfile,我的问题是我已经有了 team_nameteam_id 在 Apple Dev Center 中,但我无法获得 iTunes Connect ID/itc_team_id。我正在与不同的团队合作。我如何得到它?任何指南都会很棒。谢谢

与其尝试手动获取,不如直接 运行 fastlane 而不指定团队 ID。一旦需要选择,fastlane 将列出所有可用的 iTunes Connect 团队及其 ID,然后您可以存储此编号。

您可以直接从 Spaceship 获取它(参见 "Login" 部分)(https://github.com/fastlane/fastlane/blob/master/spaceship/docs/iTunesConnect.md)

基本上只需在 shell 中输入以下内容:

$ irb
irb> require "spaceship"
irb> Spaceship::Tunes.login("iTunesConnect_username", "iTunesConnect_password")
irb> Spaceship::Tunes.select_team

您将看到您的帐户所属球队的列表,以及该球队的数字表示。

将以下车道代码添加到您的快车道 Fastfile 和 运行 fastlane getTeamNames

 lane :getTeamNames do
  require "spaceship" 
  clientTunes = Spaceship::Tunes.login("{appleID}", "{applePassword}")
  client = Spaceship::Portal.login("{appleID}", "{applePassword}")

  strClientTunes = "" 
  clientTunes.teams.each do |team|
      UI.message "#{team['contentProvider']['name']} (#{team['contentProvider']['contentProviderId']})"
      strClientTunes << "#{team['contentProvider']['name']} (#{team['contentProvider']['contentProviderId']})||"
  end 
  File.write('ItunesTeamNames', strClientTunes[0..-3])

  strDevPortal = "" 
  client.teams.each do |team|
      UI.message "#{team['name']} (#{team['teamId']})"
      strDevPortal << "#{team['name']} (#{team['teamId']})||"
  end
  File.write('DevTeamNames', strDevPortal[0..-3])

end

从 fastlane 文件夹中的 ItunesTeamNamesDevTeamNames 文件中获取 iTunes 连接团队 ID 和团队名称

注意:- 将 {appleID}{applePassword} 替换为您的 apple id 和密码

我正在使用 fastlane,一次登录管理多个帐户。

  • 要获取所有 dev_team_ids(开发人员门户团队 ID),我 运行 使用以下命令:
    fastlane match
  • 要获取所有 c_team_ids (App Store Connect Team ID),我 运行 以下命令:
    fastlane deliver

如果您不在 Mac 上,您可以通过 iTunes connect 网站获取。

来源:https://github.com/fastlane/fastlane/issues/4301#issuecomment-253461017

最简单的方法

fastlane produce

如果您在多个团队中,它将显示

[16:36:43]: Your Apple ID Username: youremail@icloud.com
Available session is not valid any more. Continuing with normal login.
Multiple teams found on the Developer Portal, please enter the number of the team you want to use: 
1) 89******8K "B******d Incorporated" (Company/Organization)
2) B8******ZP "Sultanmyrza Kasymbekov" (Individual)

你应该选择一个,然后再选择一个

[16:38:19]: [DevCenter] App 'co.brainfood.brainfood' already exists, nothing to do on the Dev Center
Available session is not valid any more. Continuing with normal login.
Multiple App Store Connect teams found, please enter the number of the team you want to use: 
Note: to automatically choose the team, provide either the App Store Connect Team ID, or the Team Name in your fastlane/Appfile:
Alternatively you can pass the team name or team ID using the `FASTLANE_ITC_TEAM_ID` or `FASTLANE_ITC_TEAM_NAME` environment variable

  itc_team_id "1******12"

or

  itc_team_name "B******d Incorporated"

1) "B******d Incorporated" (1*******2)
2) "Sultanmyrza Kasymbekov" (1******7)

我使用 Spaceship playground。它易于使用,您不需要任何事先的项目设置。如果您在很多团队中工作并且需要定期获得 itc_team_id,您可以离开 Playground 运行。

来自shell

fastlane spaceship
[✔]  
[16:37:57]: Get started using a Gemfile for fastlane https://docs.fastlane.tools/getting-started/ios/setup/#use-a-gemfile
Username: you@youremail.com
Logging into to App Store Connect (you@youremail.com)...
Successfully logged in to App Store Connect

Logging into the Developer Portal (you@youremail.com)...
Successfully logged in to the Developer Portal

---------------------------------------
| Welcome to the spaceship playground |
---------------------------------------

Enter docs to open up the documentation
Enter exit to exit the spaceship playground
Enter _ to access the return value of the last executed command

Just enter the commands and confirm with Enter
[1] pry(#<Spaceship::Playground>)> Spaceship::Tunes.select_team

注意上面的 select_team 调用。它会向您显示您所在的团队列表以及 itc_team_id