如何防止 Xcode 8 在 .pbxproj 中保存“开发团队”?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/39669661/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to prevent Xcode 8 from saving "development team" in .pbxproj?
提问by msc
Xcode 8 demands you select a "development team" before you can sign your apps for both iOS and macOS. It wasn't very difficult to figure how to make the selection. (Answer can be found in Add developer team in Xcode 8?in case anyone can't figure it out themselves.)
Xcode 8 要求您先选择一个“开发团队”,然后才能为 iOS 和 macOS 签署您的应用程序。弄清楚如何进行选择并不难。(答案可以在 Xcode 8中的Add developer team 中找到?以防任何人自己无法弄清楚。)
The problem is that Xcode saves the selection in the .pbxproj file. Since in my case, and I expect many others, this is under SCM, and the project is used by many unrelated people & teams, this is a huge problem. For example 'git status' shows the work area is not clean as soon as the team has been selected.
问题是 Xcode 将选择保存在 .pbxproj 文件中。因为在我的情况下,我希望还有很多其他人,这是在 SCM 下,并且该项目被许多不相关的人和团队使用,这是一个巨大的问题。例如,“git status”显示团队一被选中,工作区就不是干净的。
Is there a way to either
有没有办法
- get Xcode 8 to save the selection in user rather than project data, or
- specify a default "development team" for all Xcode projects?
- 获取 Xcode 8 以将选择保存在用户而不是项目数据中,或者
- 为所有 Xcode 项目指定一个默认的“开发团队”?
采纳答案by 0xced
You can abuse Xcode's Custom Pathsmechanism to store your development team identifier outside of the project.pbxproj file by setting a DEVELOPMENT_TEAM
custom path (replace ABCDEFGHIJ
with your team identifier):
您可以滥用 Xcode 的自定义路径机制,通过设置DEVELOPMENT_TEAM
自定义路径(替换ABCDEFGHIJ
为您的团队标识符)将您的开发团队标识符存储在 project.pbxproj 文件之外:
(Xcode menu → Preferences… → Locations → Custom Paths)
(Xcode 菜单 → Preferences… → Locations → Custom Paths)
The custom paths are stored in Xcode's preferences (IDEApplicationwideBuildSettings
and IDESourceTreeDisplayNames
).
自定义路径存储在 Xcode 的首选项(IDEApplicationwideBuildSettings
和IDESourceTreeDisplayNames
)中。
But there's a catch!Unfortunately, as soon as you change anything in the project (update a build setting, add a new build phase, rename a target etc.) the development team will be automatically added to the project.pbxproj file (in the TargetAttributes
of the project object). This requires constant care not to commit those changes.
但是有一个问题!不幸的是,一旦您更改项目中的任何内容(更新构建设置、添加新构建阶段、重命名目标等),开发团队将自动添加到 project.pbxproj 文件(在TargetAttributes
项目对象的 中) . 这需要经常注意不要提交这些更改。
If this practice of setting your DEVELOPMENT_TEAM
as a custom path gains traction, open source project owners will be able to not specify any Development Teamnor Provisioning Profile, set the Code Signing Identity for Any iOS SDKto iOS Developer("CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
) and open source demo apps will build and run on any device just like it did with Xcode 7.
如果这种将您设置DEVELOPMENT_TEAM
为自定义路径的做法受到欢迎,开源项目所有者将无法指定任何开发团队或配置文件,将任何 iOS SDK的代码签名标识设置为iOS 开发人员( "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
),开源演示应用程序将像在 Xcode 7 中一样在任何设备上构建和运行。