Reputation: 43402
I have ab iPhone application that makes heavy use of a Rails json API I have built. Most of the time I am testing the local version of my API (URLs like localhost:3000/api/log_in), but I also need to test it on a remote server from time to time (URLs like someapp.com/api/log_in).
How can I easily switch the urls used by my application depending on whether I want to test against my local or remote server?
Upvotes: 1
Views: 155
Reputation: 10005
Okay. You should go like this:
Create another target (by copy the existing one)
Under Build Settings, change the Prefix Header to another filename
Create the new Prefix Header (just add a file or duplicate/add your existing Header Prefix File)
Add the same precompiler constant (#define) to both .pch file. One with your productive URL, one with your localhost URL. Instead of your "static" URL in your code, use the new set precompiler constant.
Now you can switch between localhost/production with switching targets next to your run/stop buttons
Upvotes: 2