Home > AI > IOS > UIKit >

get device identification

We need to get the information of the device for two reasons.

Firstly, it identifies user (one device can have many accounts)

Secondly, we can know what kind of device use our App at most that in the future development, we can optimize and do better in device compability.

nameStringThe name of the device.
systemNameStringThe name of the operating system running on the device.
systemVersionStringThe current version of the operating system.
modelStringThe model of the device.
localizedModelStringThe model of the device as a localized string.
userInterfaceIdiomUIUserInterfaceIdiomThe style of interface to use on the current device.
identifierForVendorUUIDAn alphanumeric string that uniquely identifies a device to the app’s vendor.
init(){
        let name = UIDevice.current.name
        let systemName = UIDevice.current.systemName
        let systemVersion = UIDevice.current.systemVersion
        let model = UIDevice.current.model
        let localizedModel = UIDevice.current.localizedModel
        let userInterfaceIdiom = UIDevice.current.userInterfaceIdiom
        let identifierForVendor = UIDevice.current.identifierForVendor
        
        print(name)
        print(systemName)
        print(systemVersion)
        print(model)
        print(localizedModel)
        print(userInterfaceIdiom)
        print(identifierForVendor)
        
    }

Leave a Reply