Unknown iPad on DeviceMetrics

I’m currently coding on an iPad Pro, and running a deviceMetrics().platformName gives me “Unknown iPad” as the iPad’s name, is this normal?

@ShatteredWindow What do you get when you run this.

function setup()
    d=deviceMetrics()
    for a,b in pairs(d) do
        print(a,b)
    end    
end
PlatformName Unknown iPad
Platform iPad6, 3
Hwmodel J127AP

I have an iPad Air, so I can’t say why. Just have to wait for another iPad Pro to run the code and see if they get the same thing.

You can work out what it is from the platform “iPad 6,3” is the 9.7 inch iPad Pro. See the complete list of codes here:

https://gist.github.com/adamawolf/3048717

platformName is a best guess from the device model. It would be more reliable to use the model (iPad 6,3) instead of platformName

Dang, that’s annoying

@ShatteredWindow You could always create your own device table and use the platform value to get the name from your table.

I’m currently in the process of doing that

@ShatteredWindow Here’s a version just in case you haven’t done yours yet.

function setup()  
    dev=    -- comma removed from key value of table
    {   i386='iPhone Simulator',
        x86_64='iPhone Simulator',
        iPhone11='iPhone',
        iPhone12='iPhone 3G',
        iPhone21='iPhone 3GS',
        iPhone31='iPhone 4',
        iPhone32='iPhone 4 GSM Rev A',
        iPhone33='iPhone 4 CDMA',
        iPhone41='iPhone 4S',
        iPhone51='iPhone 5 (GSM)',
        iPhone52='iPhone 5 (GSM+CDMA)',
        iPhone53='iPhone 5C (GSM)',
        iPhone54='iPhone 5C (Global)',
        iPhone61='iPhone 5S (GSM)',
        iPhone62='iPhone 5S (Global)',
        iPhone71='iPhone 6 Plus',
        iPhone72='iPhone 6',
        iPhone81='iPhone 6s',
        iPhone82='iPhone 6s Plus',
        iPhone83='iPhone SE (GSM+CDMA)',
        iPhone84='iPhone SE (GSM)',
        iPhone91='iPhone 7',
        iPhone92='iPhone 7 Plus',
        iPhone93='iPhone 7',
        iPhone94='iPhone 7 Plus',
        iPod11='1st Gen iPod',
        iPod21='2nd Gen iPod',
        iPod31='3rd Gen iPod',
        iPod41='4th Gen iPod',
        iPod51='5th Gen iPod',
        iPod71='6th Gen iPod',
        iPad11='iPad',
        iPad12='iPad 3G',
        iPad21='2nd Gen iPad',
        iPad22='2nd Gen iPad GSM',
        iPad23='2nd Gen iPad CDMA',
        iPad24='2nd Gen iPad New Revision',
        iPad31='3rd Gen iPad',
        iPad32='3rd Gen iPad CDMA',
        iPad33='3rd Gen iPad GSM',
        iPhone51='iPhone 5 GSM+LTE',
        iPhone52='iPhone 5 CDMA+LTE',
        iPod51='5th Gen iPod',
        iPad25='iPad mini',
        iPad26='iPad mini GSM+LTE',
        iPad27='iPad mini CDMA+LTE',
        iPad34='4th Gen iPad',
        iPad35='4th Gen iPad GSM+LTE',
        iPad36='4th Gen iPad CDMA+LTE',
        iPad41='iPad Air (WiFi)',
        iPad42='iPad Air (GSM+CDMA)',
        iPad44='iPad mini Retina (WiFi)',
        iPad45='iPad mini Retina (GSM+CDMA)',
        iPad46='iPad mini Retina (China)',
        iPad47='iPad mini 3 (WiFi)',
        iPad48='iPad mini 3 (GSM+CDMA)',
        iPad49='iPad Mini 3 (China)',
        iPad53='iPad Air 2 (WiFi)',
        iPad54='iPad Air 2 (Cellular)',
        iPad63='iPad Pro (9.7 inch, Wi-Fi)',
        iPad64='iPad Pro (9.7 inch, Wi-Fi+LTE)',
        iPad67='iPad Pro (12.9 inch, Wi-Fi)',
        iPad68='iPad Pro (12.9 inch, Wi-Fi+LTE)'
    }
       
    dm=deviceMetrics()
    key=string.gsub(dm.platform,",","") -- remove comma from dm name
    print(key)  -- show key
    print(dev[key]) -- show device name
end