Detecting Mac device ID when running an iOS app on Apple Silicon

We currently get the machine identifier in our iOS app so that we can use the type of device when communicating with our customers (i.e, you last logged in on your iPhone 12, your password was changed on the iPad Air, etc). To do this, we call sysctl with the parameters CTL_HW, HW_MACHINE for name. This returns us back a string in the format iPhone12,5 (iPhone 11 Pro Max). When running on an Apple Silicon mac, this call always returns iPad8,6, which corresponds to the iPad Pro 12.9 3rd gen. Is there anyway for us to get the actual machine type for the Mac itself instead? When running sysctl in a Mac app, we get the correct type. But it looks like for compatibility purposes, Apple has forced the type to an existing iOS device.

I am aware of ProcessInfo.processInfo.isiOSAppOnMac which can be used to at least identify if we're running on a Mac or not. But is there another call we can make that will give us the machine type for the Mac itself?

While I'm asking, are there any calls that we can make to tell us the version of macOS we are running on when running an iOS app on macOS?
Answered by munsie in 651164022
Interestingly enough I think I may have found a solution. I missed that on macOS, it's hw.model that reports back the correct identifier while it's hw.machine on iOS. I was able to verify that using hw.model, I was able to pull the correct information.
Accepted Answer
Interestingly enough I think I may have found a solution. I missed that on macOS, it's hw.model that reports back the correct identifier while it's hw.machine on iOS. I was able to verify that using hw.model, I was able to pull the correct information.
Detecting Mac device ID when running an iOS app on Apple Silicon
 
 
Q