Using the TARGET_IPHONE_SIMULATOR macro results in the same constant values being defined in am application. For example:
#ifdef TARGET_IPHONE_SIMULATOR
NSString * const Mode = @"Simulator";
#else
NSString * const Mode = @"Device";
#endif
- (void)applicationDidFinishLaunching:(UIApplication *)application
{
...
NSLog(@"Mode: %@", Mode);
...
}
Always results in “Mode: Simulator” being logged. I’m currently running XCode 3.2.4 if that helps. Thanks.
TARGET_OS_SIMULATORis defined on the device (but defined to false). The fix is:Not sure when this was changed. I’m fairly sure it was possible to use ‘ifdef’ in the past.