iosobjective-cxcode6.4

iOS XCode: How to load a value from a user-defined setting from build settings at run time


I've got the following constant in the code:

static NSString* const MyUrl = @"www.myurl.com";

Is it possible at all to create a user-defined setting and assign a value which can replace the value of MyUrl const at run time or during archive?

My situation is the following: I have a project with various targets. Each target points to a different URL in the code. It would be great if I could manage the URL through a user-defined setting rather than having to change the code every time I change the target.


Solution

  • Consider using info.plist for storing such values.