How to get iTunes connect Team ID and Team name?

I'm writing down an Appfile for fastlane, my problem is I already have the team_name and team_id in Apple Dev Center but I can't get the iTunes Connect ID/itc_team_id. I'm working with different team. How do I get it? Any guide would be great. Thanks

34620 次浏览

Instead of trying to get it manually, just run fastlane without specifying the team ID. Once the selection is required, fastlane will list all the available iTunes Connect teams and their IDs, and you can then store this number.

You can get it directly from Spaceship (See the "Login" section) (https://github.com/fastlane/fastlane/blob/master/spaceship/docs/iTunesConnect.md)

Basically just type the following in a shell:

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

You'll be presented with a list of teams your account belongs to, along with the numerical representation for that team.

Add below lane code to your fastlane Fastfile and run 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

Get iTunes connect Team ID and Team name from ItunesTeamNames and DevTeamNames files in fastlane folder

Note:- Replace {appleID} and {applePassword} with your apple id and password

I'm using fastlane, managing multiple accounts with one login.

  • To get all dev_team_ids (Developer Portal Team ID), I run the following command:
    fastlane match
  • To get all c_team_ids (App Store Connect Team ID), I run the following command:
    fastlane deliver

If you are not on your Mac, you can get it through the iTunes connect website.

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

Easiest way

fastlane produce

if you are in multiple teams it will show

[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)

you should choose one after it will as you again

[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)

I use the Spaceship playground. It is easy to use and you don't need any prior project setup. If you are working on a lot of teams and need to get the itc_team_id on a regular basis, you can leave the Playground running.

From 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

Note the select_team call above. It will show you the list of the teams you are on along with the itc_team_id