diff options
author | Timur Pocheptsov <timur.pocheptsov@theqtcompany.com> | 2015-10-01 10:33:42 +0200 |
---|---|---|
committer | Timur Pocheptsov <timur.pocheptsov@theqtcompany.com> | 2015-10-08 07:13:20 +0000 |
commit | 371818e71839280abafae858e9bb53c4ee6b9e5e (patch) | |
tree | 9dacde59e220ca9b79a218d8d24c9806fe9cee6d /src/bluetooth/osx/osxbtledeviceinquiry.mm | |
parent | 81a8a8771f987ebfefbffc1a7a4003cbf0a1760d (diff) |
CoreBluetooth - update for iOS 9.0
New SDK removed deprecated properties/methods and we have a compilation error
as a result.
Use performSelector instead of direct calls to make sure:
1. it compiles
2. it calls an existing method.
Task-number:QTBUG-48518
Change-Id: I10a2d062f9e71229a1e218d9d167a4132b97b6ab
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'src/bluetooth/osx/osxbtledeviceinquiry.mm')
-rw-r--r-- | src/bluetooth/osx/osxbtledeviceinquiry.mm | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/bluetooth/osx/osxbtledeviceinquiry.mm b/src/bluetooth/osx/osxbtledeviceinquiry.mm index af304d8d..c46c68fc 100644 --- a/src/bluetooth/osx/osxbtledeviceinquiry.mm +++ b/src/bluetooth/osx/osxbtledeviceinquiry.mm @@ -295,8 +295,8 @@ using namespace QT_NAMESPACE; Q_ASSERT_X(delegate, Q_FUNC_INFO, "invalid delegate (null)"); -#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_9, __IPHONE_6_0) - if (QSysInfo::MacintoshVersion >= qt_OS_limit(QSysInfo::MV_10_9, QSysInfo::MV_IOS_6_0)) { +#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_9, __IPHONE_7_0) + if (QSysInfo::MacintoshVersion >= qt_OS_limit(QSysInfo::MV_10_9, QSysInfo::MV_IOS_7_0)) { if (!peripheral.identifier) { qCWarning(QT_BT_OSX) << Q_FUNC_INFO << "peripheral without NSUUID"; return; @@ -310,15 +310,25 @@ using namespace QT_NAMESPACE; return; } #endif - if (!peripheral.UUID) { - qCWarning(QT_BT_OSX) << Q_FUNC_INFO << "peripheral without UUID"; + // Either SDK or the target is below 10.9/7.0: + // The property UUID was finally removed in iOS 9, we have + // to avoid compilation errors ... + CFUUIDRef cfUUID = Q_NULLPTR; + + if ([peripheral respondsToSelector:@selector(UUID)]) { + // This will require a bridged cast if we switch to ARC ... + cfUUID = reinterpret_cast<CFUUIDRef>([peripheral performSelector:@selector(UUID)]); + } + + if (!cfUUID) { + qCWarning(QT_BT_OSX) << Q_FUNC_INFO << "peripheral without CFUUID"; return; } - StringStrongReference key(uuid_as_nsstring(peripheral.UUID)); + StringStrongReference key(uuid_as_nsstring(cfUUID)); if (![peripherals objectForKey:key.data()]) { [peripherals setObject:peripheral forKey:key.data()]; - const QBluetoothUuid deviceUuid(OSXBluetooth::qt_uuid(peripheral.UUID)); + const QBluetoothUuid deviceUuid(OSXBluetooth::qt_uuid(cfUUID)); delegate->LEdeviceFound(peripheral, deviceUuid, advertisementData, RSSI); } } |