Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CFUUID Vs. advertisingIdentifier Vs. identifierForVendor

Tags:

ios

I'm confused on what should I use to uniquely identify my users?

I want to support iOS7 too but i dont understand the differences.

I'm currently using this snippet to generate a UUID:

CFUUIDRef udid = CFUUIDCreate(NULL);
NSString* createdUUID = (NSString *) CFUUIDCreateString(NULL, udid);
[createdUUID autorelease];
CFRelease(udid);
like image 204
Tomer Even Avatar asked Dec 20 '22 01:12

Tomer Even


1 Answers

  • identifierForVendor a unique identifier shared by all your apps on the user's device. If the user has more than one app made by you they will all share this identifier. This identifier will be reset if the user deletes all the apps by the same vendor.
  • advertisingIdentifier unique identifier that can be used to track use for advertising purposes. Can be reset by the the user.
  • CFUUID just a class that creates an UUID every time you call it.

The code you posted will create a new unique identifier every time it is called. You should store this identifier in NSUSerDefaults or Keychain and read it from there to build some kind of user tracking.

like image 87
rckoenes Avatar answered Dec 22 '22 15:12

rckoenes