iosxcodexcconfiguser-defined-fields

reading user define build setting in xcode


I have a user defined variable called "ENVIRONMENT"

I have a plist with this entry

Environment = ${ENVIRONMENT}

in my xcconfig:

ENVIRONMENT=Dev

I also set the configuration file for the project to see my xcconfig file.

I know this part works because it creates my ENVIRONMENT variable in the user defined area for my target.

So I run this line in my app delegate did finish launching:

NSLog(@"Env = %@", [[NSBundle mainBundle] objectForInfoDictionaryKey:@"Environment"]);

How can I use the xcconfig file to set a value on main plist file for the project?


Solution

  • I went to the target with the A made from pencils. Clicked duplicate and to build a copy. Set the configuration for each sub target created and it works