Skip to content

Instantly share code, notes, and snippets.

@jagbolanos
Created February 8, 2012 21:12
Show Gist options
  • Select an option

  • Save jagbolanos/1773924 to your computer and use it in GitHub Desktop.

Select an option

Save jagbolanos/1773924 to your computer and use it in GitHub Desktop.
Create a UDID for the Device
/*
UNIQUE IDENTIFIER
*/
+ (NSString*) deviceIdentifier {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSString *deviceId = [defaults objectForKey:DEVICE_ID_KEY];
if (!deviceId) {
//Create unique ID
CFUUIDRef newUniqueId = CFUUIDCreate(kCFAllocatorDefault);
CFStringRef newUniqueIdString = CFUUIDCreateString(kCFAllocatorDefault, newUniqueId);
deviceId = [NSString stringWithFormat:@"%@",(NSString *)newUniqueIdString];
CFRelease(newUniqueId);
CFRelease(newUniqueIdString);
//deviceId = [self getMacAddress];
//Save it
[defaults setObject:deviceId forKey:DEVICE_ID_KEY];
[defaults synchronize];
}
return deviceId;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment