How do you get an iPhone's device name

Viewed 127024

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?

10 Answers

For xamarin user, use this

UIKit.UIDevice.CurrentDevice.Name

For Swift 4+ versions, please use the below code:

UIDevice.current.name

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 ?? "") // ABCDEF01-0123-ABCD-0123-ABCDEF012345
    print(name)       // Name's iPhone
    print(version)    // 14.5
    print(modelName)  // iPhone
    print(osName)     // iOS
    print(localized)  // iPhone

In Unity, using C#:

SystemInfo.deviceName;
Related