1

XCode obviously knows my name because it puts it at the top of each new file I create (created by Quentin Liedtke) and also has my first name in the xcuserdata folder (Quentin.xcuserdatad).

I'd like to be able to harness this in my code. Is there a preprocessor macro or configuration function or some other way that I can get this string in my code?

4

1 回答 1

2

我找到了自己问题的答案:

在 Build Settings -> Preprocess Macros 添加:

DEVELOPER_NAME=@\""$USER"\"

然后它可以在代码中使用:

NSLog("%@", DEVELOPER_NAME);
于 2013-01-30T18:30:24.720 回答