Skip to content

Instantly share code, notes, and snippets.

@sendoa
Created November 23, 2012 13:13
Show Gist options
  • Save sendoa/4135566 to your computer and use it in GitHub Desktop.
Save sendoa/4135566 to your computer and use it in GitHub Desktop.
Obtener UUID
//http://mobiledevelopertips.com/core-services/create-universally-unique-identifier-uuid-the-ios-6-way.html
//The class NSUUID implements RFC 4122 creating values that are 128 bits long and guaranteed to be unique across space and time by using a unique value on the device as well as a value representing the elapsed time since October 15, 1582 at 00:00:00.
// iOS 6
NSUUID *uuid = [NSUUID UUID];
NSLog(@"UUID: %@", [uuid UUIDString]);
// Output: UUID: A84AFC3C-B3A7-31C7-B3E9-234AF423C6B1
// iOS < 6
CFUUIDRef uuid = CFUUIDCreate(NULL);
CFStringRef identifier = CFUUIDCreateString(NULL, uuid);
CFRelease(uuid);
NSString *uuidString = CFBridgingRelease(identifier);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment