XCode 4.5.2: Finding unavailable API using MAC_OS_X_MAX_ALLOWED and the 10.8 SDK'
XCode 4.5.2: Finding unavailable API using MAC_OS_X_MAX_ALLOWED and the 10.8 SDK'
- Subject: XCode 4.5.2: Finding unavailable API using MAC_OS_X_MAX_ALLOWED and the 10.8 SDK'
- From: Nick Beadman <email@hidden>
- Date: Tue, 29 Jan 2013 10:22:02 -0800
I am trying to get Xcode 4.5.2 to show me all of my usage of API that is not available in 10.6 while still using the 10.8 SDK.
Tec Note TN2064 says that I can set MAC_OS_X_MAX_ALLOWED to 1060 [1] which I do so in 'Other C Flags' [OTHER_CFLAGS] using "-DMAC_OS_X_MAX_ALLOWED=1060".
However, then the Cocoa/Cocoa.h precompiled header fails with:
/System/Library/Frameworks/AppKit.framework/Headers/NSApplication.h:447:1: error: use of empty enum
which is as expected becuase:
enum {
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
NSRemoteNotificationTypeNone = 0,
NSRemoteNotificationTypeBadge = 1 << 0,
#endif
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8
NSRemoteNotificationTypeSound = 1 << 1,
NSRemoteNotificationTypeAlert = 1 << 2,
#endif
};
will be precompiled down to:
enum {
};
In this instance it would be fairly easy to fix using:
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
enum {
NSRemoteNotificationTypeNone = 0,
NSRemoteNotificationTypeBadge = 1 << 0,
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8
NSRemoteNotificationTypeSound = 1 << 1,
NSRemoteNotificationTypeAlert = 1 << 2,
#endif
};
#endif
but I don't want to change system headers and I think it is unlikely if this were the only problem with these macros.
Is there another way to determine if you are calling newer API than available in the Deployment Target? I realize I can check the linkage before calling the API but I am interested in the compiler flagging all of my usage so I can make sure they are all properly guarded.
Thanks,
Nick
[1] it actually says to set it to MAC_OS_X_MIN_REQUIRED but that is already 1060 because MACOSX_DEPLOYMENT_TARGET is set to 1060.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden