Open the Settings app to check your iOS information: Tap General. Tap About. It will show the device info, including the device name.
In iOS, the user-assigned device name is available in the Settings app under General > About > 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'.
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;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With