4

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:

xcode nav bar

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!

Jakob
  • 872
  • 10
  • 26
  • have you referred this, http://stackoverflow.com/a/3748348/6742121? @Jakob – KAR Oct 27 '16 at 13:35
  • yes thanks - the target builds & runs fine though, the suggestions in that question do not mitigate the issue I am seeing. – Jakob Oct 27 '16 at 14:15

1 Answers1

0

this seems to have been an Xcode 8.1 bug. Issue seems to have resolved itself in Xcode 8.2 beta.

Jakob
  • 872
  • 10
  • 26