Testing for presence of Apple platform in C/C++/ObjC code

Are we running on an Apple platform?
#ifdef __APPLE__
Prerequisite for other tests
#ifdef __APPLE__
// let Apple define 
// various TARGET_OS_ 
// constants
// not on Apple platform
#define TARGET_OS_MAC 0
Are we running on Mac OS X?
Are we running on an iOS device?
// updated on Oct13 2010, previous method was flawed. sorry everyone!

via blog.vucica.net

Leave a Reply

Your email address will not be published.


What is 14 + 7 ?
Please leave these two fields as-is:
IMPORTANT! To be able to proceed, you need to solve the following simple math (so we know that you are a human) :-)

This site uses Akismet to reduce spam. Learn how your comment data is processed.