Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating UUID and UDID in iOS 7

Tags:

ios

iphone

ios7

I want to create UUID, I have code below which can create UUID, how can I create UDID with multiple vendors same ID in iOS7?

+ (NSString*) stringWithNewUUID
{
    CFUUIDRef uuidObj = CFUUIDCreate(nil);
    NSString *newUUID = (NSString*)CFUUIDCreateString(nil, uuidObj);
    CFRelease(uuidObj);
    return newUUID;
}
like image 840
Sandeep Khade Avatar asked Oct 09 '13 06:10

Sandeep Khade


2 Answers

The CFUUIDCreate function produces a version 4 UUID which is taken entirely from a pseudo-random number generator. There are no timestamps or MAC addresses embedded in this type of UUID. (That refers to the little-used version 1 flavour.) These are safe to use for nearly all applications.

like image 57
gavinb Avatar answered Oct 02 '22 00:10

gavinb


This method returns random UUID in iOS 6 and above

[[UIDevice currentDevice]identifierForVendor]
like image 28
Arun_ Avatar answered Oct 02 '22 01:10

Arun_