Are we running on an Apple platform?
#ifdef __APPLE__
…
#endif
Prerequisite for other tests
#ifdef __APPLE__
// let Apple define
// various TARGET_OS_
// constants
// let Apple define
// various TARGET_OS_
// constants
#endif
Are we running on Mac OS X?
#if TARGET_OS_MAC && !TARGET_OS_IPHONE
….
#endif
Are we running on an iOS device?
#if TARGET_OS_IPHONE
….
#endif
// updated on Oct13 2010, previous method was flawed. sorry everyone!
–
via blog.vucica.net