in an older project I'm using the TARGET_OS_IPHONE precompiler macro in several places to implement some iOS-specific things.
This used to work fine in the past, but currently Xcode seems to have this macro "inverted" in such way that code-completion doesn't work within #if TARGET_OS_IPHONE
blocks, even though my build target is an iOS app. There's also no syntax-highlighting. It syntax-highlights and code-completes the things in the #else
block which should only happen on a macOS target. As far as I can tell, it builds correctly though, just the editor seems confused. This makes editing code quite irritating. I am using Xcode 8.1 GM.
Might this be an Xcode bug, or is there possibly some configuration in my project which got messed up? It seems Xcode is looking at the wrong headers for a reason. When I CMD-click on the TARGET_OS_IPHONE
macro, it navigates to this file:
which has the macro values for macOS, not the ones for iOS:
#define TARGET_OS_OSX 1
#define TARGET_OS_IPHONE 0
Seems that it chooses the wrong SDK. Not sure where to look / change this back to normal. I've looked at the target build settings, and they look ok.
thanks!