-
-
Save stephenkeep/6620731 to your computer and use it in GitHub Desktop.
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
//ios6 | |
SString *UUID = [[NSUUID UUID] UUIDString]; | |
//ios5 | |
- (BOOL)application:(UIApplication *)application | |
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | |
{ | |
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