Differences between UDID and UUID

来源:互联网 发布:为知笔记产品经理 招聘 编辑:程序博客网 时间:2024/03/29 08:17

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.

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.

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/

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.


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


0 0