在构建时更改iOS项​​目的团队设置

时间:2021-06-08 06:37:34

I want to be able to change the Team used for code signing an iOS target at build time, using a configuration, build variable or similar mechanism. As far as I can tell, the only way to access the Team setting is via the dropdown in the target's "General" configuration tab, and it is stored in the project file. Right now, I have created a second target with another team set, which is a lot of duplicated settings to just change this one parameter.

我希望能够在构建时使用配置,构建变量或类似机制更改用于代码签署iOS目标的团队。据我所知,访问团队设置的唯一方法是通过目标的“常规”配置选项卡中的下拉列表,并将其存储在项目文件中。现在,我已经使用另一个团队集创建了第二个目标,这是一个重复的设置,只需更改这个参数即可。

Is there a more flexible way to control the Team setting?

是否有更灵活的方式来控制团队设置?

1 个解决方案

#1


You can achieve this using shell scripting by changing the DevelopmentTeam variable in your .pbxproj file. Simply fetch the current team using -

您可以通过更改.pbxproj文件中的DevelopmentTeam变量来使用shell脚本来实现此目的。只需使用以下方式获取当前团队

awk -F '=' '/DevelopmentTeam/ {print $2; exit}' project.pbxproj

awk -F'=''/ DevelopmentTeam / {print $ 2; exit}'project.pbxproj

Replace that using sed with your new development team replacing its 10-digit certificate id.

将sed替换为新开发团队替换其10位证书ID。

sed -i '' 's/old_team_cert_id/new_team_cert_id/g' project.pbxproj

sed -i''s / old_team_cert_id / new_team_cert_id / g'project.pbxproj

#1


You can achieve this using shell scripting by changing the DevelopmentTeam variable in your .pbxproj file. Simply fetch the current team using -

您可以通过更改.pbxproj文件中的DevelopmentTeam变量来使用shell脚本来实现此目的。只需使用以下方式获取当前团队

awk -F '=' '/DevelopmentTeam/ {print $2; exit}' project.pbxproj

awk -F'=''/ DevelopmentTeam / {print $ 2; exit}'project.pbxproj

Replace that using sed with your new development team replacing its 10-digit certificate id.

将sed替换为新开发团队替换其10位证书ID。

sed -i '' 's/old_team_cert_id/new_team_cert_id/g' project.pbxproj

sed -i''s / old_team_cert_id / new_team_cert_id / g'project.pbxproj