I always forget this syntax!

#import <TargetConditionals.h>


- (void)methodThatRunsOnlyOnDevice() {
        // Do stuff that would work only on the device
        // Maybe log that this method is not running because on the simulator?

I try to avoid preprocessor macros as much as possible, they are a code smell, and add yet another path that needs to be tested, but that is intrinsically hard to test.

That said, in some cases they can be handy. For example when you have a piece of code that absolutely cannot run on the Simulator. In that case the only way to make sure this doesn’t happen is checking for the TARGET_IPHONE_SIMULATOR conditional.