45

Some people say UDID (Unique Device IDentifier) and some say UUID (Universally Unique IDentifier). Are they are the same or not? What are the differences between them?

Abdurrahman Mubeen Ali
  • 1,331
  • 1
  • 13
  • 19
Imran Qadir Baksh - Baloch
  • 32,612
  • 68
  • 179
  • 322
  • 1
    Did the duplicate question get modified? The duplicate question is not asking anything related, and the answer that it claims to have is buried and added on as an after thought marked with "(*)". Is it possible to remove duplicate tags? This one wasted a good 5 minutes of my time... – Mars Nov 06 '17 at 05:49

5 Answers5

99

UUID (Universally Unique IDentifier) Is on a per-app basis. identifies an app on a device. As long as the user doesn’t completely delete the app, then this identifier will persist between app launches, and at least let you identify the same user using a particular app on a device. Unfortunately, if the user completely deletes and then reinstalls the app then the ID will change.

UDID (Unique Device Identifier) A sequence of 40 hexadecimal characters that uniquely identify an ios device. This value can be retrieved through iTunes, or found using UIDevice -uniqueIdentifier. Derived from hardware details like MAC address.

Rugmangathan
  • 3,186
  • 6
  • 33
  • 44
  • how can i get UUID? and how many character in UUID and where it used basically – Rahul Sharma Jun 25 '15 at 10:47
  • UUID is a 128bit character and UUID is represented by 32 lowercase hexadecimal digit. And you can get UUID by refering this SO Post http://stackoverflow.com/questions/14352418/how-to-generate-uuid-in-ios – Rugmangathan Jun 25 '15 at 12:07
  • 1
    @Rugmangathan : How to get UDID programmatically? – Jayprakash Dubey Aug 05 '16 at 12:57
  • @JayprakashDubey, No, you cannot get UDID anymore, instead you can use `identifierForVendor()`. For more follow this SO post http://stackoverflow.com/a/31652454/2849567 – Rugmangathan Aug 08 '16 at 09:53
  • 4
    UUID isn't on a per-app basis, it's a standard used for creating "unique" id's. identifierForVendor() is what you're referring to, which returns A UUID, but advertisingIdentifier is also a UUID. – Mars Nov 06 '17 at 05:37
  • UUID does not persist between app launches, it generates a new identifier each time we call the method `UUID().uuidString`. – Saif Feb 25 '20 at 03:44
  • Your definition of UUID is just one possible implementation of a UUID, but not what a UUID _actually is_. – Mamouneyya Nov 28 '22 at 22:00
9

You better to go through this- http://nshipster.com/uuid-udid-unique-identifier/

UUID (Universally Unique Identifier): A sequence of 128 bits that can guarantee uniqueness across space and time, defined by RFC 4122.

UDID (Unique Device Identifier): A sequence of 40 hexadecimal characters that uniquely identify an iOS device (the device's Social Security Number, if you will). This value can be retrieved through iTunes, or found using UIDevice -uniqueIdentifier. Derived from hardware details like MAC address.

Jeroen Vannevel
  • 43,651
  • 22
  • 107
  • 170
user3182143
  • 9,459
  • 3
  • 32
  • 39
5

Apple is apparently starting to remove access to the UDID (Unique Device IDentifier) in iOS5. In any event, the best you can now do for identification purposes is to use a UUID (Universally Unique IDentifier). This has to be on a per-app basis. That is, there is no way to identify the device any longer, but you can identify an app on a device. As long as the user doesn’t completely delete the app, then this identifier will persist between app launches, and at least let you identify the same user using a particular app on a device. Unfortunately, if the user completely deletes and then reinstalls the app then the ID will change, but this is the best anyone can do going forward.

Gajendra Rawat
  • 3,673
  • 2
  • 19
  • 36
5

Since from iOS 5, Apple has deprecated the UIDevice uniqueIdentifier , that means traditional way of getting the unique id of each iOS device won't work now ie. [[UIDevice currentDevice] uniqueIdentifier] fails from iOS 5 and more.

So for the alternative to the UUID , we can use the CFUUID class of Apple in order to create unique id for device. But, we really need to keep in mind that this inbuild class will create random numbers so they will return different ids on every call. Don't use NSUserDefaults for storing it, best way is to use Keychain.

So, here I am giving you the best way of using it in order to use it as a unique key for your device.

- (NSString *)createNewUUID {

    CFUUIDRef theUUID = CFUUIDCreate(NULL);
    CFStringRef string = CFUUIDCreateString(NULL, theUUID);
    CFRelease(theUUID);
    return [(NSString *)string autorelease];
}

UDID:

http://whatsmyudid.com/

enter image description here

codercat
  • 22,873
  • 9
  • 61
  • 85
  • 2
    As a small note, the picture you've attached is labeled saying "to get the UUID;" however, it's actually obtaining the UDID. I'm not expecting a fix, just wanted to jot that down so other readers will be aware. – Spencer D Sep 24 '14 at 19:54
  • 1
    You need understand UUID is not UDID. – Yi Jiang Sep 09 '15 at 03:59
  • 1
    The above image is incorrect, it show UDID, not UUID. UDID is unique string for each device (`[[UIDevice currentDevice] uniqueIdentifier]`). UUID is the random number, give you a random string every you create it (`CFUUIDRef theUUID = CFUUIDCreate(NULL);`). – huynguyen Mar 20 '16 at 07:30
  • 1
    image is correct, the note in red color by the author is not. – early May 14 '16 at 17:49
1

UDID, which is Unique Device Identifier, applied in iTunes, manage devices in your apple development certificate. it can be got by following code, in iOS5 SDK:

[UIDevice currentDevice] uniqueIdentifier];

define is:

@property(nonatomic,readonly,retain) NSString    *uniqueIdentifier  __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_NA,__MAC_NA,__IPHONE_2_0,__IPHONE_5_0);  // a string unique to each device based on various hardware info.

UUID, which is Universally Unique Identifier, an identifier standard used in software construction, standardized by the Open Software Foundation (OSF) as part of the Distributed Computing Environment (DCE)(wiki).

You can get UUID by following code:

-(NSString*) uuid {  
    CFUUIDRef puuid = CFUUIDCreate( nil );  
    CFStringRef uuidString = CFUUIDCreateString( nil, puuid );  
    NSString * result = (NSString *)CFStringCreateCopy( NULL, uuidString);  
    CFRelease(puuid);  
    CFRelease(uuidString);  
    return [result autorelease];  
}

But, in iOS7 device, above method will return the same value for difference device.

There are many methods to fetch unique identifiers in the link

simalone
  • 2,768
  • 1
  • 15
  • 20