1. UDID

UDID stands for Unique Device Identifier. As the name suggests, it is the Unique Identifier of Apple iOS devices. It consists of 40 characters of letters and numbers. It is often used in many applications that need to limit one zhang Hong per device. Well, you can get the device’s UDID in iOS5, but it’s completely disabled in iOS7. A pre-ios 7 app running on a device later than iOS7 does not undo the device’s UDID, but instead returns a string starting with FFFFF followed by a hexadecimal value. Obtained: [[UIDevice currenDevice] uniqueIdentifier Discarded: iOS6

2.IDFV

IDFV is matched by the first two parts of the BundleID’s DNS cross-string. If they are identical, the same value is returned. For example, the two bundleids com.any. hello and com.any. word are the same as the IDFV generated by the Vender. If the user uninstalls all the apps of the Vender, the IDFV obtained again will be different from the previous one and will be reset. How to obtain :[[[UIDevice currentDevice] identifierForVendor] UUIDString] Trial: iOS6+ Note: Unique identifiers cannot be guaranteed

3.IDFA

The logo is used for advertising marking, push advertising. User can go to Settings -> Privacy -> Ads to reset the value of this ID. [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString] Trial: iOS6+ note: This value is unique if the user has not modified the system Settings, but can be turned off or reset manually by the user

4.MAC

After iOS7, the value cannot be obtained (it is a fixed value) deprecated :iOS7+

5.KeyChain

Overview: An iOS system has a KeyChain. Each application can record data in the KeyChain and only read the data recorded in the KeyChain. And even if we delete the program, the system after upgrading, reinstall the application, to obtain the value is still unchanged (system restoration, except the brush). So we can store the UUID string in the KeyChain and get the unique identifier directly from the KeyChain next time for example:

+ (NSString *)UUID {
    KeychainItemWrapper *keyChainWrapper = [[KeychainItemWrapper alloc] initWithIdentifier:@"MYAppID" accessGroup:@"com.test.app"];
    NSString *UUID = [keyChainWrapper objectForKey:(__bridge id)kSecValueData];

    if (UUID == nil || UUID.length == 0) {
        UUID = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
        [keyChainWrapper setObject:UUID forKey:(__bridge id)kSecValueData];
    }

    return UUID;
}
Copy the code

6.AppleAccount

Brief introduction: Although Apple has disabled the acquisition of UUID after iOS6, it can obtain UUID through private API, but this method has risks. For example, the private API may be changed, leading to the failure to obtain UUID. Obtaining private API will affect AppStore review. Private header files can be obtained through dump only on jailbroken devices

@class NSObject<OS_dispatch_semaphore>, APSConnection.NSData;

@interface AADeviceInfo : NSObject {

APSConnection *_apsConnection;

BOOL _tokenDone;

NSData *_token;

NSObject<OS_dispatch_semaphore> *_tokenSema;

}

+ (id)userAgentHeader;

+ (id)signatureWithDictionary:(id)arg1;

+ (id)apnsToken;

+ (id)serialNumber;

+ (id)clientInfoHeader;

+ (id)appleIDClientIdentifier;

+ (id)productVersion;

+ (id)osVersion;

+ (id)udid;

+ (id)infoDictionary;

- (id)wifiMacAddress;

- (id)regionCode;

- (id)deviceClass;

- (id)osName;

- (id)productType;

- (id)apnsToken;

- (id)serialNumber;

- (id)deviceInfoDictionary;

- (id)appleIDClientIdentifier;

- (id)productVersion;

- (id)osVersion;

- (id)udid;

- (id)init;

- (void).cxx_destruct;

- (id)buildVersion;

@end
Copy the code

[AADeviceInfo uDID] [AADeviceInfo udid] [AADeviceInfo uDID] [AADeviceInfo uDID] [AADeviceInfo uDID] [AADeviceInfo uDID] [AADeviceInfo uDID] (Details: After exporting AppleAccount. Framework, go to the root directory of AppleAccount. Framework, create a Headers folder, and place the dumped Headers file in the Headers directory. It can be used in a project as if it were referencing a third party framework, exporting the framework via jailbreak.

Two, through the algorithm to calculate the unique identifier

1.SimulateIDFA

Introduction: SimulatorIDFA is a string of MD5 values integrated by computing various information of devices, used to mark the use of different devices:

CoreTelephony. Framework (download the code https://github.com/youmi/SimulateIDFACopy the code

Note: The SimulatorIDFA device information includes the system version, and the unique identifier will change if you upgrade.

2.OpenIDFA

Introduction: OpenIDFA is an open source library by Yann Lechelle. The replacement scheme of IDFA is also a string that is integrated by calculating some information of the device through the algorithm.

Timeliness comparison:

  1. OpenIDFA

SimulateIDFA SimulateIDFA is divided into two parts. The first 16 bits of SimulateIDFA will change when the system is upgraded. The last 16 bits of SimulateIDFA may change the value (such as restarting the phone, modifying the device name, and modifying the local language of the phone).

Conclusion:

OpenIDFA has some limitations. The generated IDFA changes daily and has a high repetition rate under extreme conditions. SimulateIDFA performs better in this respect

Check whether IDFA is applied

To check whether we use AD identifiers in our projects is to check whether we –

  1. Whether there is a framework called adsupport. framework in the framework;
  2. If the framework is not found, it may be found in the third party we access. Use the following method to check whether the third party contains the IDFA version.
(1) Open the terminal CD to the directory of the file to be checked; 2. Run the grep -r advertisingIdentifier command.Copy the code

Compare the stability of device ids:

situation IDFA(Advertising Identifier) IDFA stored in Keychain OpenUDID OpenUDID saved in Keychain
Delete the application Will not change Will not change, will not be deleted Will not change Will not change, will not be deleted
Restore all Settings on your phone Will not change Will not change, will not be deleted Will not change Will not change, will not be deleted
The phone wiped all the data change Be deleted change Be deleted
Restore the AD identifier change Data stored in the Keychain does not change unless rewritten Will not change Will not change, will not be deleted
Apps from different developers on the same device (different signatures) Will not change Will not change, will not be deleted change If the keychain is not rewritten, it is NULL

Follow-up changes and then update the content, the first conclusion

IOS Obtain device UUID and IDFA OpenUDID and IDFA comparison open-source framework OpenUDID source code and pseudo-source code analysis