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)