在每个项目的 Xcode 中定义 __MyCompanyName__? [英] Define __MyCompanyName__ in Xcode per project?

查看:23
本文介绍了在每个项目的 Xcode 中定义 __MyCompanyName__?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经看到如何通过终端命令全局定义 __MyCompanyName__ 宏值,该值显示在 XCode 的所有标题注释中:

I've seen how to define the __MyCompanyName__ macro value that displays in all header comments in XCode by defining it globally via a terminal command:

defaults write com.apple.Xcode PBXCustomTemplateMacroDefinitions '{"ORGANIZATIONNAME" = "My Company";}'

但是,我确实在多个公司名称下工作,并且想要一种简单的方法来根据我正在从事的项目进行切换.我意识到我可以只编写一个简单的 shell 脚本来做到这一点,但是我仍然必须记住每次打开一个项目时都要运行它.我是否缺少一种在某处静态定义每个项目的简单方法?(这似乎是一个必须跳过的愚蠢圈套……Apple,你好?)

However, I do work under multiple company names and would like an easy way to switch this depending on what project I'm working on. I realize that I can just write a simple shell script to do this, but then I still have to remember to run it every time I open a project. Am I missing an easy way to define this per project statically somewhere? (This seems like a silly hoop to have to jump through... Apple, hello?)

推荐答案

从 Xcode 3.2 (IIRC) 开始,这是每个项目的设置.
只需在 Xcode 中获取项目信息"即可.它就在常规"标签上.

Since Xcode 3.2 (IIRC) this is a per-project setting.
Just "Get Info" on your project in Xcode. It's right there on the "General" tab.

更新以上答案适用于 Xcode 3.2.见 Sri Sankaran's &下面是 aeldron 对 Xcode 4 的回答.

Update The above answer is for Xcode 3.2. See Sri Sankaran's & aeldron's answers below for Xcode 4.

更新同样适用于 Xcode 4 的是下面 trtwn 答案的第一部分.换句话说,在地址簿中设置公司"是解决问题的一种方法,以防公司在特定 Mac 上的 Xcode 中创建的所有新文件始终相同.

Update Also appropriate for Xcode 4 is the first part of trtwn's answer below. in other words, setting the "company" in the address book is one way to solve the problem in case the company will always be the same for all New files created in Xcode on a particular mac.

这篇关于在每个项目的 Xcode 中定义 __MyCompanyName__?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆