You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the reported model on macOS is something like arm64 instead of a model identifier I expected. (Like MacBookPro18,1.)
I suspect this is a bug as iOS and macOS report different kind of values when querying the machine value. Also see the excellent blog on this at Cocoa with Love.
Therefore I would like to propose to change the behaviour by implementing specific logic for macOS to get the value for the model property instead of the architecture. This seems to be more useful and in line with what people might expect.
A reliable way to get the model on macOS is using IOKit:
// From: https://stackoverflow.com/a/50008492/586489privatefunc getModelIdentifier()->String?{letservice=IOServiceGetMatchingService(kIOMainPortDefault,IOServiceMatching("IOPlatformExpertDevice"))varmodelIdentifier:String?
if let modelData =IORegistryEntryCreateCFProperty(service,"model"asCFString, kCFAllocatorDefault,0).takeRetainedValue()as?Data{
modelIdentifier =String(data: modelData, encoding:.utf8)?.trimmingCharacters(in:.controlCharacters)}IOObjectRelease(service)return modelIdentifier
}
Happy to create a Pull Request if this is indeed a change we want to maken and if it would help the maintainers.
The text was updated successfully, but these errors were encountered:
mac-cain13
changed the title
Model on macOS actually is system architecture
Model on macOS actually is actually the system architecture
Apr 5, 2023
If this property is changed it would be great to still have the architecture available in another property, as I personally find it useful (despite the slightly confusing naming).
Currently the reported model on macOS is something like
arm64
instead of a model identifier I expected. (LikeMacBookPro18,1
.)I suspect this is a bug as iOS and macOS report different kind of values when querying the machine value. Also see the excellent blog on this at Cocoa with Love.
Therefore I would like to propose to change the behaviour by implementing specific logic for macOS to get the value for the model property instead of the architecture. This seems to be more useful and in line with what people might expect.
A reliable way to get the model on macOS is using IOKit:
Happy to create a Pull Request if this is indeed a change we want to maken and if it would help the maintainers.
The text was updated successfully, but these errors were encountered: