ios - Environment Variables not picked up by code through plist -


in main target .plist file have this:

<key>hihomepage</key> <string>$(my_base_url)</string> 

i'm using build schema per each environment have (development, staging, production), set my_base_url in environment variables in build step of schema.

then in code have this:

nsstring *baseurl = [[nsbundle mainbundle] objectforinfodictionarykey:@"hihomepage"]; 

that turns out empty string, stuff such cfbundlename being picked up.

what missing here?

to values environment variables use following code

nsstring *baseurl = [[[nsprocessinfo processinfo] environment] objectforkey:@"my_base_url"]; 

ref : http://rosettacode.org/wiki/environment_variables#objective-c

to add items in plist scheme, should dd user defined build settings name my_base_url , enter values per scheme. use in .plist file.

for adding user defined build settings, select target editor menu > add settings > user defined settings


Comments