Monday, 15 June 2015

Detect in Xcode iPhone project whether I'm building for simulator or device? -


Can I compile conditionally in my app, based on whether I made it for simulator or device Am I (My app has a hook on an external server: If I'm running on the device, I want to connect to the local host; if I'm running on the device, then I want to go to my production server.)

I'm looking for some #ifdef variables that I know, or anything at runtime ... does not matter.

Thank you.

  #if! (TARGET_IPHONE_SIMULATOR)  

Or, alternatively,

  # (TARGET_OS_IPHONE)  

will tell you whether You are running on the device. To make this work, you must include the

# "TargetConditionals.h"

file that you can find.


No comments:

Post a Comment