From 18af3226765b62312acc8f801cc531fde0d9822b Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Mon, 2 Oct 2017 13:27:13 +0200 Subject: CoreBluetooth - fix compilation errors for 10.13 SDK MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Apple broke source code compatibility by moving 'identifier' properties from CBPeripheral and CBCentral classes into the new CBPeer class and marking it as "since 10.13". As a result we have compilation errors in the code that was valid since 10.7. To workaround this issue, we introduce a category with 'identifier' property declarations for SDK >= 10.13 and target < 10.13. Change-Id: Id7c9d33a9c8ae7627a06b4c1930e70cede1e5b07 Reviewed-by: Tor Arne Vestbø --- src/bluetooth/osx/osxbtutility_p.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/bluetooth/osx/osxbtutility_p.h b/src/bluetooth/osx/osxbtutility_p.h index 148ebc0b..5d90a54e 100644 --- a/src/bluetooth/osx/osxbtutility_p.h +++ b/src/bluetooth/osx/osxbtutility_p.h @@ -313,4 +313,23 @@ Q_DECLARE_LOGGING_CATEGORY(QT_BT_OSX) QT_END_NAMESPACE +#if QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(101300) && QT_MACOS_DEPLOYMENT_TARGET_BELOW(101300) + + // In the macOS 10.13 SDK, the identifier property was moved from the CBPeripheral + // and CBCentral classes to a new CBPeer base class. Because CBPeer is only available + // on macOS 10.13 and above, the same is true for -[CBPeer identifier]. However, + // since we know that the derived classes have always had this property, + // we'll explicitly mark its availability here. This will not adversely affect + // using the identifier through the CBPeer base class, which will still require macOS 10.13. + +@interface CBPeripheral (UnguardedWorkaround) +@property (readonly, nonatomic) NSUUID *identifier NS_AVAILABLE(10_7, 5_0); +@end + +@interface CBCentral (UnguardedWorkaround) +@property (readonly, nonatomic) NSUUID *identifier NS_AVAILABLE(10_7, 5_0); +@end + +#endif + #endif -- cgit v1.2.3