Created
November 10, 2012 15:34
-
-
Save sey/4051408 to your computer and use it in GitHub Desktop.
getUUID
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+ (NSString *)getUUID | |
{ | |
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; | |
if ([defaults stringForKey:@"UUID"]) | |
{ | |
return [defaults stringForKey:@"UUID"]; | |
} | |
else | |
{ | |
CFUUIDRef theUUID = CFUUIDCreate(NULL); | |
CFStringRef string = CFUUIDCreateString(NULL, theUUID); | |
CFRelease(theUUID); | |
[defaults setObject:(__bridge NSString *)string forKey:@"UUID"]; | |
return (__bridge NSString *)string; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment