BenjaminB
BenjaminB

Reputation: 1869

Macro defined when targeting iOS

Is there a macro defined when compiling for iOS ? I found __APPLE__ but I need a macro defined only when targeting iOS.

In a broader view, I'm unable to find a web page describing those macro for Xcode, is there any ?

Upvotes: 1

Views: 92

Answers (2)

JDM
JDM

Reputation: 893

define TARGET_OS_IPHONE

define TARGET_IPHONE_SIMULATOR

Found in TargetConditionals.h

Upvotes: 0

Tommy Devoy
Tommy Devoy

Reputation: 13549

You could probably use one of the macros in TargetConditionals.h

#if TARGET_OS_IPHONE
        // do iPhone work
#endif

#if TARGET_IPHONE_SIMULATOR
        // do iPhone simulator work
#endif

#if TARGET_OS_MAC
        // do Mac work
#endif

Upvotes: 1

Related Questions