Skip to content

Instantly share code, notes, and snippets.

@ewangke
Created June 27, 2013 13:39
Show Gist options
  • Save ewangke/5876485 to your computer and use it in GitHub Desktop.
Save ewangke/5876485 to your computer and use it in GitHub Desktop.
UDID migration for unique identifier within a specific app
NSString *UUID = [[NSUserDefaults standardUserDefaults] objectForKey:kApplicationUUIDKey];
if (!UUID) {
CFUUIDRef uuid = CFUUIDCreate(NULL);
UUID = (__bridge_transfer NSString *)CFUUIDCreateString(NULL, uuid);
CFRelease(uuid);
[[NSUserDefaults standardUserDefaults] setObject:UUID forKey:kApplicationUUIDKey];
[[NSUserDefaults standardUserDefaults] synchronize];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment