Setting up user specific preprocessor macros for Xcode

I'd like to be able to have specific code blocks such as #ifdef SOME_VARIABLE and the value of variable would be filled at project's build time if the project is being built on a specific user's machine.

Is that possible?


You set the value in the "Preprocessor Macros" Build Settings. Setting "SOME_VARIABLE=${USER}" in the build settings is equivalent to #define SOME_VARIABLE "jappleseed" in your code.

Then in your code you can do this:

#define jappleseed 1
#define sjobs      2

#if DEV_USER == jappleseed
    NSLog(@"Hi Jhonny");
#elif DEV_USER == sjobs
    NSLog(@"Hi Steve");

Note: This is a contrived example if you really want the string "jappleseed" for use in your code you should be using an Info.plist and not #define

Need Your Help

CMD to have a keystroke stop a script

cmd shutdown interactive restart abort

I need to create a batch script that will run a reboot command but give you the option to stop the script with "the push of any key".

limit: 1 difference in schema.rb boolean fields

mysql ruby-on-rails git rails-migrations

I recently started noticing that following a deployment to production, I see this git diff in my db/schema.rb there:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.