It's in the SDK docs under "Compiling source code conditionally"
The relevant definitions are TARGET_OS_IPHONE and TARGET_IPHONE_SIMULATOR, which will be defined provided that you
#include "TargetConditionals.h"
Since that won't exist on non apple platforms, you can wrap your include like this
#ifdef __APPLE__
#include "TargetConditionals.h"
#endif
before including that file
So, for example, if you want to check that you are running on device, you should do
#if !(TARGET_IPHONE_SIMULATOR)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.