
- iOS Tutorial
- iOS - Home
- iOS - Getting Started
- iOS - Environment Setup
- iOS - Objective-C Basics
- iOS - First iPhone Application
- iOS - Actions and Outlets
- iOS - Delegates
- iOS - UI Elements
- iOS - Accelerometer
- iOS - Universal Applications
- iOS - Camera Management
- iOS - Location Handling
- iOS - SQLite Database
- iOS - Sending Email
- iOS - Audio & Video
- iOS - File Handling
- iOS - Accessing Maps
- iOS - In-App Purchase
- iOS - iAd Integration
- iOS - GameKit
- iOS - Storyboards
- iOS - Auto Layouts
- iOS - Twitter & Facebook
- iOS - Memory Management
- iOS - Application Debugging
- iOS Useful Resources
- iOS - Quick Guide
- iOS - Useful Resources
- iOS - Discussion
How to generate Unique ID of device for iPhone/iPad using Swift?
UDID(Unique Device Identifier) − A sequence of 40 hexadecimal characters that uniquely identify an iOS device.
Since from iOS 5, Apple has deprecated the UIDevice unique identifier, that means the traditional way of getting the unique id. Apple removed the truly unique identifier and introduced an identifier for each vendor i.e UUID that's the same for all apps for a given developer for each user, but varies between developers and between devices.
Apple has defined an instance property identifier for the vendor, which is an alphanumeric string that uniquely identifies a device to the app’s vendor.
You can read more about it here: https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor
So we will see how we can get, Copy the below code in viewDidLoad method,
override func viewDidLoad() { super.viewDidLoad() guard let deviceID = UIDevice.current.identifierForVendor?.uuidString else { return } print(deviceID) // 7ABAB8B5-E805-437F-9D6C-5448BB19AEA5 }
- Related Articles
- How to access unique Android device ID?
- How to determine device type (iPhone, iPod Touch) with Swift?
- Is their JavaScript scroll event for iPhone/iPad?
- How to make iPhone vibrate using Swift?
- How to determine device type (iPhone, iPod Touch) with iPhone SDK?
- How to hide Back Button on navigation bar on iPhone/iPad?
- HTML5 inline video on iPhone vs iPad/Browser
- How to create a left-arrow button on a Toolbar on iPhone/iPad?
- How to get and store device ID in Android using Kotlin?
- How to get device id in android?
- How to add a unique id for an element in HTML?
- How to specify a unique id for an element in HTML?
- How to create a unique ID for each object in JavaScript?
- How to get programmatically android device secure id?
- What are the best New features added to iPhone and iPad with iOS12?
