From 9e1098caf7084070406cef0bf4736cb898249a3b Mon Sep 17 00:00:00 2001 From: Filip Date: Tue, 17 Sep 2024 14:34:09 +0200 Subject: [PATCH] Update SystemUUID.swift Fix For older Maxos platforms. #available(macOS 12, *) is not available on runtime for older platforms it must be replaced by Compiletime directive #if MACOS12_OR_LATER --- .../device_info_plus/macos/Classes/SystemUUID.swift | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/device_info_plus/device_info_plus/macos/Classes/SystemUUID.swift b/packages/device_info_plus/device_info_plus/macos/Classes/SystemUUID.swift index 0b93b221dd..23ddcde839 100644 --- a/packages/device_info_plus/device_info_plus/macos/Classes/SystemUUID.swift +++ b/packages/device_info_plus/device_info_plus/macos/Classes/SystemUUID.swift @@ -6,11 +6,13 @@ public struct SystemUUID { let dev = IOServiceMatching("IOPlatformExpertDevice") var platformExpert: io_service_t - if #available(macOS 12, *) { + #if MACOS12_OR_LATER + print("Running on macOS 12 or newer") platformExpert = IOServiceGetMatchingService(kIOMainPortDefault, dev) - } else { + #else + print("Running on an older version of macOS") platformExpert = IOServiceGetMatchingService(kIOMasterPortDefault, dev) - } + #endif let serialNumberAsCFString = IORegistryEntryCreateCFProperty(platformExpert, kIOPlatformUUIDKey as CFString, kCFAllocatorDefault, 0) IOObjectRelease(platformExpert)