xcode11ios13uikitformac

"Token is not a valid binary operator in a preprocessor subexpression" when using UIKitForMac


So I'm trying to compile my iOS project for the mac, and when I try to use

#if !targetEnvironment(UIKitForMac)

I'm getting the error from the title.

I tried setting the build target to iOS 13, but didn't seem to have any effect.


Solution

  • If you're using objective-c and not swift you should use:

    #if !TARGET_OS_UIKITFORMAC
    #endif