Ios: Fix compiler warnings

- avoid deprecated API
- remove unused variable

Change-Id: I33850ea2dda523900ead191542eadf65338d5210
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Eike Ziller
2022-05-11 11:35:12 +02:00
parent 3791d732f0
commit b4caecae3e

View File

@@ -486,7 +486,12 @@ void IosDeviceManager::monitorAvailableDevices()
CFRelease( cfProductIdMaskValue ); CFRelease( cfProductIdMaskValue );
} }
IONotificationPortRef notificationPort = IONotificationPortCreate(kIOMasterPortDefault); #if QT_MACOS_DEPLOYMENT_TARGET_BELOW(120000)
const mach_port_t port = kIOMasterPortDefault; // deprecated in macOS 12
#else
const mach_port_t port = kIOMainPortDefault; // available since macOS 12
#endif
IONotificationPortRef notificationPort = IONotificationPortCreate(port);
CFRunLoopSourceRef runLoopSource = IONotificationPortGetRunLoopSource(notificationPort); CFRunLoopSourceRef runLoopSource = IONotificationPortGetRunLoopSource(notificationPort);
CFRunLoopAddSource(CFRunLoopGetCurrent(), runLoopSource, kCFRunLoopDefaultMode); CFRunLoopAddSource(CFRunLoopGetCurrent(), runLoopSource, kCFRunLoopDefaultMode);
@@ -495,16 +500,14 @@ void IosDeviceManager::monitorAvailableDevices()
CFRetain(matchingDictionary); CFRetain(matchingDictionary);
// Now set up a notification to be called when a device is first matched by I/O Kit. // Now set up a notification to be called when a device is first matched by I/O Kit.
kern_return_t kr; IOServiceAddMatchingNotification(notificationPort,
kr = IOServiceAddMatchingNotification(notificationPort,
kIOMatchedNotification, kIOMatchedNotification,
matchingDictionary, matchingDictionary,
deviceConnectedCallback, deviceConnectedCallback,
NULL, NULL,
&gAddedIter); &gAddedIter);
IOServiceAddMatchingNotification(notificationPort,
kr = IOServiceAddMatchingNotification(notificationPort,
kIOTerminatedNotification, kIOTerminatedNotification,
matchingDictionary, matchingDictionary,
deviceDisconnectedCallback, deviceDisconnectedCallback,