Skip to content

Instantly share code, notes, and snippets.

@wjlafrance
Created March 30, 2012 08:51
Show Gist options
  • Save wjlafrance/2249975 to your computer and use it in GitHub Desktop.
Save wjlafrance/2249975 to your computer and use it in GitHub Desktop.
Use you a CFUUID! No ARC for you!
NSString *uuid = [[NSUserDefaults standardUserDefaults] stringForKey:@"CFUUID"];
if (!uuid) {
CFUUIDRef cfuuid = CFUUIDCreate(NULL);
uuid = [(NSString *)CFUUIDCreateString(NULL, cfuuid) autorelease];
[[NSUserDefaults standardUserDefaults] setValue:uuid forKey:@"CFUUID"];
[[NSUserDefaults standardUserDefaults] synchronize];
CFRelease(cfuuid);
}
NSLog(@"UUID: %@", uuid);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment