This address: http://blog.csdn.net/zhaoyabei/article/details/46682765
It is a problem for every company that wants to track and count users, naturally without the user's unique identifier. In history, a lot of unique identifiers, such as Udid, MAC address, Openudid, and so on, no longer describe how they hang up, and now the only thing left is the IDFA, IDFV, Uuid+keychain.
IDFA (advertising Identifier): You can understand the advertising identifiers provided by the advertising Id,apple company for tracking users.
Cons: Users can restore by setting-privacy-ad-Restore AD identifier, then new to identifier;
Request ios>=6.0.
Use:
#import <AdSupport/AdSupport.h> nsstring *idfa= [[[Asidentifiermanager Sharedmanager] Advertisingidentifier] Uuidstring];</span>
IDFV (Identifierforvendor): The unique identifier provided to vendor by Apple, vendor represents the application developer, when actually used, A vendor is the first two parts of the cfbundleidentifier (reverse DNS format). For example, Com.baidu.tieba and Com.baidu.image get the same IDFV because the first two parts of their cfbundleidentifier are the same.
Cons: After uninstalling all the applications of the same developer, the IDFV will be different when installed again. Let's say you have two apps on your phone: paste,
Requirements: ios>=6.0
Use:
<span style= "FONT-SIZE:18PX;" > NSString *IDFV = [[[Uidevice Currentdevice] Identifierforvendor] uuidstring];</span>
UUID (Universally unique Identifier): Universal Unique identification code, each generation is different, so the first build after the need to save to the keychain, so that even if the app is removed and re-installed can still get it from the keychain.
Use:
There are many kinds of uuid generation methods, only one is written here. Generate a UUID:
-(nsstring*) UUID { Cfuuidref puuid = cfuuidcreate (nil); Cfstringref uuidstring = cfuuidcreatestring (nil, puuid); NSString * result = (NSString *) cfbridgingrelease (cfstringcreatecopy (NULL, uuidstring)); Cfrelease (puuid); Cfrelease (uuidstring); return result;}
The uuid is stored in the keychain, where a third-party tool is used Sfhfkeychainutils,github address
[Sfhfkeychainutils storeusername:@ "UDID" andpassword:[self uuid] forservicename:@ "ZYB" Updateexisting:1 Error:nil];
remove the UUID from the keychain:
[Sfhfkeychainutils getpasswordforusername:@ "UDID" andservicename:@ "ZYB" Error:nil]
Note that if there is no storage, the direct removal will be crash.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
[Ios]ios8 available method of identifying users (IDFA, UUID, IDFV)