How do you get an iPhone's device name

前端 未结 9 1600
我在风中等你
我在风中等你 2020-11-29 22:26

If you open Settings -> General -> About, it\'ll say Bob\'s iPhone at the top of the screen. How do you programmatically grab that name?

9条回答
  •  鱼传尺愫
    2020-11-29 23:23

    For swift4.0 and above used below code:

        let udid = UIDevice.current.identifierForVendor?.uuidString
        let name = UIDevice.current.name
        let version = UIDevice.current.systemVersion
        let modelName = UIDevice.current.model
        let osName = UIDevice.current.systemName
        let localized = UIDevice.current.localizedModel
        
        print(udid ?? "")
        print(name)
        print(version)
        print(modelName)
        print(osName)
        print(localized)
    

提交回复
热议问题