Apple deprecated usage of UDID. What is next? Alternatives of UDID.

Alternatives of UDID

  As we know apple deprecated using and accessing the user’s device unique identifier (UDID). Many iOS Apps rejected that are using UDID for tracking user information and misusing this information for the sake of Advertise management and User usage management etc. Deprecation of accessing user device unique identifier preventing strikes on user privacy.
Is there any replacement for UDID? – Yes

Step 1: SwiftKeychainWrapper –

SwiftKeychainWrapper is working similar to NSUserDefault. The difference between both of them is NSUserDefault store lightweight data at App level, Means once you uninstall App from device  NSUserDefault data is being deleted. But in the case of SwiftKeychainWrapper, The data will keep as it is in device KeyChain after App installation. Device keychain data is only accessed when the device is active and unlocked. Use CocoaPods to install the keychain  SwiftKeychainWrapper library. If you don’t know how to install CocoaPods please visit this page and follow the given steps.


Usage – Add value to device keychain:

Retrieve  value from device keychain:

Remove value from device keychain:

Step 2 –  UUID – (Universally Unique Identifiers)

UUID is a unique value that can be used to differentiate types, interfaces, and other related stuff. This is known as a Globally Unique Identifier. It has 128-bit values. The standard format of  UUID is defined in ASCII form and string punctuated by hyphens.

For example – 66753A54-1D7F-1226-9C60-0050E4D00459

Syntax –     

Swift 4 :       

 Swift 3 :      


Now get UUID when the user installs app first time. store this UUID in the device keychain with the proper key name. Next time check that UUID is stored in keyChain or not. If it already stored get the UUID and use it. Otherwise, generate and store UUID. Please check the given code. Code –  

Done with the replacement of UDID functionality. Thanks for reading please share and comment it if you found something useful in this article.    

1 thought on “Apple deprecated usage of UDID. What is next? Alternatives of UDID.”

Leave a Comment