Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you get an iPhone's device name

Tags:

ios

uikit

People also ask

How do I find my iPhone device name?

Open the Settings app to check your iOS information: Tap General. Tap About. It will show the device info, including the device name.

What is iOS device name?

In iOS, the user-assigned device name is available in the Settings app under General > About > Name.

What is the default iPhone device name?

The default device name for your iPhone as set by Apple when you set up your device for the first time is simply 'iPhone'.

How do I give my device a name?

In the Windows Phone app, go to Settings > Preferences. Under Name your phone, type the name you've chosen.


From the UIDevice class:

Swift version:

UIDevice.current.name

Objective-C version:

[[UIDevice currentDevice] name];

The UIDevice is a class that provides information about the iPhone or iPod Touch device.

Some of the information provided by UIDevice is static, such as device name or system version.

source: http://servin.com/iphone/uidevice/iPhone-UIDevice.html

Offical Documentation: Apple Developer Documentation > UIDevice Class Reference


In addition to the above answer, this is the actual code:

[[UIDevice currentDevice] name];


Remember: import UIKit

Swift:

UIDevice.currentDevice().name

Swift 3, 4, 5:

UIDevice.current.name

Here is class structure of UIDevice

+ (UIDevice *)currentDevice;

@property(nonatomic,readonly,strong) NSString    *name;              // e.g. "My iPhone"
@property(nonatomic,readonly,strong) NSString    *model;             // e.g. @"iPhone", @"iPod touch"
@property(nonatomic,readonly,strong) NSString    *localizedModel;    // localized version of model
@property(nonatomic,readonly,strong) NSString    *systemName;        // e.g. @"iOS"
@property(nonatomic,readonly,strong) NSString    *systemVersion;