Using UnityEngine.iOS.DeviceGeneration to detect iPhone XS

Hello,

I’ve been using “if (UnityEngine.iOS.Device.generation == UnityEngine.iOS.DeviceGeneration.iPhoneX)” to detect if the user is on an iPhone X, and move several UI elements away from the notch. It’s been working fine, but a beta tester who just got the iPhone XS said that it doesn’t work on his phone. I’m guessing it’s because I should be using DeviceGeneration.iPhoneXS or something, but according to the documentation there’s only an entry for iPhone X. Is there a simple way to fix this that I’m not aware of? I tried searching, but couldn’t find anything about it. Thank you!

Here is the strategy that I’ve been using…

1. Check that the device is an iPhone:

     if (System.deviceModel.IndexOf("iPhone")) > -1
    
2. If so, determine the ratio of screen width to height (convert ints to floats):

     screenRatio = (1.0*Screen.width)/(1.0*Screen.height)
     
3. Then if:

     1.4 < screenRatio < 1.6   // 3:2 iPhones - models 4 and earlier
     1.7 < screenRatio < 1.8   // 16:9 iPhones - models 5, SE, up to 8+
     2.1 < screenRatio < 2.2   // 19.5:9 iPhones - models X, Xs,  Xr, Xsmax

If you have a web app or a website you can detect any iPhone model using wurfl.js
You simply include this javascript on you page:

<script type="text/javascript" src="//wurfl.io/wurfl.js"></script>

and then a JavaScript object is available in the DOM:

WURFL= {
    "is_mobile": true,
    "complete_device_name": Apple iPhone Xs,
    "form_factor": smartphone
}