robhasacamera
robhasacamera

Reputation: 3346

Different Builds for Simulator and iPhone

The app that I'm working on has a URL that it accesses for data, this URL is defined as a constant as follows:

#define kURLToSendRequestsTo @"http://www.localhost.com/dataAccess.php"

However, this URL will only work for the simulator. For the iPhone I have to change the URL to a test site manually.

What I need is a way to change it dynamically so I don't have to manually change it each time. Something like this:

#if iPhone

#define kURLToSendRequestsTo @"http://www.localhost.com/dataAccess.php"

#elseif simulator

#define kURLToSendRequestsTo @"http://www.testsite.com/dataAccess.php"

#endif

Upvotes: 1

Views: 109

Answers (1)

trojanfoe
trojanfoe

Reputation: 122458

The constants you want are:

TARGET_IPHONE_SIMULATOR

and:

TARGET_OS_IPHONE

Reference.

Upvotes: 1

Related Questions