This code works just fine in the simulator and on my iPhone, that is, after the first launch the ID is saved, but it does not work on my iPad?!?! WTH, anybody have any idea how this could be?
Code:
// Use instead of uniqueIdentifier
if ([[NSUserDefaults standardUserDefaults] objectForKey:@"appID"] != NULL) {
NSLog(@"UserDefault loaded = %@", [[NSUserDefaults standardUserDefaults] objectForKey:@"appID"]);
} else {
CFUUIDRef UUID = CFUUIDCreate(NULL);
CFStringRef idStringRef = CFUUIDCreateString(NULL, UUID);
// Cast to NSString to silence warning
NSString *idString = (NSString *)idStringRef;
NSUserDefaults *dfltID = [NSUserDefaults standardUserDefaults];
[dfltID setObject:idString forKey:@"appID"];
NSLog(@"UserDefault saved = %@", [[NSUserDefaults standardUserDefaults] objectForKey:@"appID"]);
}