The system header TargetConditionals.h defines several macros which you can use from C and Objective-C to determine which platform you're using.
#import <TargetConditionals.h> // imported automatically with Foundation
- (void)doSomethingPlatformSpecific {
#if TARGET_OS_IOS
// code t...