plus_plugins
plus_plugins copied to clipboard
[Bug]: Compilation issue on MacOS 10
Platform
Mac os 10
Plugin
device_info_plus
Version
9.1.2
Flutter SDK
3.0.0
Steps to reproduce
For older systems kIOMainPortDefault is not available in scope during compile time and so it throws an error. device_info_plus-9.1.2/macos/Classes/SystemUUID.swift:10:58: error: cannot find 'kIOMainPortDefault' in scope platformExpert = IOServiceGetMatchingService(kIOMainPortDefault, dev). If fixed that by changing runtime check to compile time check. To recreate:
- Try to compile package on older systems To fix:
in Class: /plus_plugins/packages/device_info_plus/device_info_plus/macos/Classes/SystemUUID.swift
Code Sample
To fix this issue:
Replace:
Runtime check
if #available(macOS 12, *) {
platformExpert = IOServiceGetMatchingService(kIOMainPortDefault, dev)
} else {
platformExpert = IOServiceGetMatchingService(kIOMasterPortDefault, dev)
}
With:
Compile Time check.
#if MACOS12_OR_LATER
print("Running on macOS 12 or newer")
platformExpert = IOServiceGetMatchingService(kIOMainPortDefault, dev)
#else
print("Running on an older version of macOS")
platformExpert = IOServiceGetMatchingService(kIOMasterPortDefault, dev)
#endif
Logs
fix available above.
Flutter Doctor
fix available above.
Checklist before submitting a bug
- [X] I searched issues in this repository and couldn't find such bug/problem
- [X] I Google'd a solution and I couldn't find it
- [X] I searched on StackOverflow for a solution and I couldn't find it
- [X] I read the README.md file of the plugin
- [X] I'm using the latest version of the plugin
- [X] All dependencies are up to date with
flutter pub upgrade
- [X] I did a
flutter clean
- [X] I tried running the example project
Hello! Since the minimum supported target is 10.14, this should be addressed.
I'll try to reproduce the issue first using GitHub CI, and if I can reproduce the compilation issue, then I'll apply your patch suggestion.
I tried to compile the project using a macos-11 image (it is the lowest I could find) and the project compiled correctly: https://github.com/fluttercommunity/plus_plugins/actions/runs/8447836608/job/23138853477?pr=2758
So I could not reproduce the compilation issue.
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 15 days