0

I would like to automate XCode to set/replace certain variables or plist values depending on what environment I am building for.

Example: When building for production, I would like this line in a class header file to be...

define kServerName @"www.mydomain.com"

...and for development...

define kServerName @"dev.mydomain.com"

...and for staging...

define kServerName @"staging.mydomain.com"

Also, perhaps set a value in a plist similarly.

Thanks in advance!

Community
  • 1
  • 1
E-Madd
  • 4,414
  • 5
  • 45
  • 77

1 Answers1

0

You need to add different schemas for different targets and set flags accordingly in your build setting. After that in your code can use these flags to check which environment you are pointing to and can use #ifdef statement to create #defines.

Link for setting schema and another link on how to set targets in xcode

Community
  • 1
  • 1
iDev
  • 23,310
  • 7
  • 60
  • 85