Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"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.

like image 769
Jan Avatar asked Jun 23 '26 17:06

Jan


1 Answers

Objective-C

#if !TARGET_OS_MACCATALYST
// Code to exclude from Mac.
#endif

Swift

#if !targetEnvironment(macCatalyst)
// Code to exclude from Mac.
#endif

Sources:

  • https://developer.apple.com/documentation/uikit/creating_a_mac_version_of_your_ipad_app?language=objc

  • https://developer.apple.com/documentation/xcode/creating_a_mac_version_of_your_ipad_app

like image 155
Alex Walczak Avatar answered Jun 25 '26 13:06

Alex Walczak



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!