0

im getting errors and warnings with the following code:

  1. Warning undeclared selector uniqueIdentifier at the first if statement;
  2. Error Property uniqueIdentifier not found on object of type UIDevice
  3. 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"]; } } 
1
  • Unique identifier is depreciated in iOS 7 now... identifierForVendor and advertisingIdentifier are available in ios 7 Commented Jan 15, 2014 at 19:35

2 Answers 2

3

UIDevice uniqueIdentifier property is deprecated in iOS 5 and above

 udid = [[[UIDevice currentDevice] identifierForVendor] UUIDString]; NSLog(@"UDID : %@", udid); 
Sign up to request clarification or add additional context in comments.

Comments

0
  1. You must create a method with name uniqueIdentifier
  2. UIDevice does not have a property called uniqueIdentifier. See this answer.
  3. Look at this answer.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.