iphone - How to use different URLs for Simulator and Device -


I am creating a web application.

When I'm testing on a simulator, I usually want to use a local loop URL example below because the test can mess up the data on the actual server when I am on a device To test / release, I want to use a real server.

I can change the value manually, but it's easy to forget to change it. If possible, I'm looking for a solution myself.

e.g. If I'm using debug or just run, then I know that I can use the debug flag set by the project settings to produce different codes.

i.e.

  #ifdef DEBUG KURL = @ "http: // localhost / xyx" #else kURL = @ "http: // realserver / xyz" #endif < / Code> 

Since the flag is automatically set by Xcode, I still have to choose whether to run or debug it from the menu), it allows me manually set the flag manually in the code Protects against whether it is run for debug or run.

Although it is useful, the DEBUG flag has no use to detect any simulator or device running on the device.

I do not know whether a signal is running on the device or not / the name of the SDK, because it seems that they use different SDKs), that I have different URLs I can use the code to give instructions.

Any thoughts?

Thank you.

You can use TARGET_IPHONE_SIMULATOR and TARGET_OS_IPHONE (I think)


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -