iOS: Fix retrieving USB serial number with macOS 10.15 SDK

When building without explicit compatibility with oder macOS versions
(-mmacosx-version-min), the Apple headers use a different value for the
constant that is used to retrieve the USB serial number, and that just
doesn't work for some reason.

Make sure we use a value for the constant that works in all cases.

Fixes: QTCREATORBUG-23460
Change-Id: Ie7de52a49a41c2ad33b2a6d2410414a9f1f05b1e
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
Eike Ziller
2020-01-16 10:32:05 +01:00
parent 5f8fe92105
commit 92a39e8d86

View File

@@ -42,6 +42,16 @@
#include <IOKit/IOKitLib.h>
#include <IOKit/usb/IOUSBLib.h>
#include <CoreFoundation/CoreFoundation.h>
// Work around issue with not being able to retrieve USB serial number.
// See QTCREATORBUG-23460.
// For an unclear reason USBSpec.h in macOS SDK 10.15 uses a different value if
// MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_14, which just does not work.
#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_14
#undef kUSBSerialNumberString
#define kUSBSerialNumberString "USB Serial Number"
#endif
#endif
#include <exception>