I have a couple of Apple devices in my network (both computers and mobile devices). I was wondering if it is possible, to get the model identifier like Macmini9,1 if I have the IP address and/or the Mac address.
I am using the NetServiceBrowser
and NetService
classes to find the devices. If the device has the AirPlay
service, I can get the model identifier.
However, not all of my devices seem to implement/publish this service. Is there a more general approach?
macOS seems to know this information. In the Finder a specific icon is shown, so I guess the model identifier must be published somehow.
macOS seems to know this information.
Right. macOS publishes a TXT record with this info and knows how to search for it. The exact details are not documented as API [1] but have been reverse engineered many times.
IMPORTANT If you decide to rely on it, keep in mind that it could change, or even go away, without notice. Such is the nature of relying on implementation details.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
[1] Although I’m glad to see that the service type it uses is officially registered.
https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml?search=device-info