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

If!(TARGET_IPHONE_SIMULATOR) or, alternatively if (TARGET_OS_IPHONE) will tell you if you're running on the device. In order for it to work, you must include "TargetConditionals. H file that you can find here.

If!(TARGET_IPHONE_SIMULATOR) or, alternatively, #if (TARGET_OS_IPHONE) will tell you if you're running on the device. In order for it to work, you must #include "TargetConditionals. H" file that you can find here.

Thanks...that seems to work. Any way to find out what else is defined in "TargetConditionals. H"?

I can't find the file anywhere... – Greg Maletic Dec 1 '09 at 21:17 Correction...your second example (TARGET_OS_IPHONE) always succeeds, provided, of course, you're doing iPhone development. Your first example, TARGET_IPHONE_SIMULATOR, is what I'm looking for, and that only succeeds if you're running on the simulator (vs. the device. ) – Greg Maletic Dec 1 '09 at 21:42 Edited with a link to the file.

– luvieere Dec 1 '09 at 22:51 3 I've never included that file and TARGET_IPHONE_SIMULATOR always seems to work - it could already be included by the foundation. – Kendall Helmstetter Gelner Dec 1 '09 at 23:38.

Will tell you if you're running on the device. File that you can find here. I created a macro in which you can specify which actions you want to perform inside parentheses and these actions will only be performed if the device is being simulated.

#define SIM(x) if (UIDevice currentDevice. Model lowercaseString rangeOfString:@"simulator". Terms of service.

Not the answer you're looking for?

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions