im getting errors and warnings with the following code:
- Warning undeclared selector uniqueIdentifier at the first if statement;
- Error Property uniqueIdentifier not found on object of type UIDevice
- Error Cast of C pointer type CFStringRef
// Get the users Device Model, Display Name, Unique ID, Token & Version Number
UIDevice *dev = [UIDevice currentDevice];
NSString *deviceUuid;
if ([dev respondsToSelector:@selector(uniqueIdentifier)]) // Warning #1
deviceUuid = dev.uniqueIdentifier; // Error #1
else {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
id uuid = [defaults objectForKey:@"deviceUuid"];
if (uuid)
deviceUuid = (NSString *)uuid;
else {
CFStringRef cfUuid = CFUUIDCreateString(NULL, CFUUIDCreate(NULL));
deviceUuid = (NSString *)cfUuid; // Error #2
CFRelease(cfUuid);
[defaults setObject:deviceUuid forKey:@"deviceUuid"];
}
}