My iOS App uses a specific server for production: http://mydomain.com/serverapi
. While developing I would like to change this to http://localhost/serverapi
. What is an elegant way to tell XCode to use the local URL by default.
Obviously it's very important, that a production release contains the production URL (Archiving in XCode.
Another use case would be to change the icon or app identifier while in development, to be able to tell the app apart from the version which might already be installed on the device.
I use macros for this (as Pablo suggested), but if you have a separate Info.plist file for different build configurations (as I do), then you could have a custom entry in your Info.plist and access it like so:
[[[NSBundle mainBundle] infoDictionary] objectForKey:@"MyAppURL"]
However, macros are likely faster at runtime as they are compiled in. This is just another option.
Below is an image of the project setting.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With