在构建时更改 iOS 项目的团队设置 [英] Changing the Team setting of an iOS project at build time
问题描述
我希望能够在构建时使用配置、构建变量或类似机制更改用于对 iOS 目标进行代码签名的团队.据我所知,访问团队设置的唯一方法是通过目标的常规"配置选项卡中的下拉菜单,它存储在项目文件中.现在,我已经用另一个团队设置创建了第二个目标,这是很多重复的设置,只是更改了这个参数.
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.
是否有更灵活的方式来控制团队设置?
Is there a more flexible way to control the Team setting?
推荐答案
您可以使用 shell 脚本通过更改 .pbxproj
文件中的 DevelopmentTeam
变量来实现此目的.只需使用 -
You can achieve this using shell scripting by changing the DevelopmentTeam
variable in your .pbxproj
file. Simply fetch the current team using -
awk -F '=' '/DevelopmentTeam/{print $2;退出}' project.pbxproj
将使用 sed
替换为您的新开发团队替换其 10 位证书 ID.
Replace that using sed
with your new development team replacing its 10-digit certificate id.
sed -i '' 's/old_team_cert_id/new_team_cert_id/g' project.pbxproj
这篇关于在构建时更改 iOS 项目的团队设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!