Current location - Trademark Inquiry Complete Network - Trademark inquiry - How to identify the unique identifier in Apple ios multi-open
How to identify the unique identifier in Apple ios multi-open

In the IOS system, there are many ways to obtain the unique identifier of the device:

1. UDID (Unique Device Identifier)

The full name of UDID is Unique Device Identifier. As the name suggests, it is the unique identification code of Apple's IOS device, which consists of 40 characters of letters and numbers.

2. UUID (Universally Unique Identifier)

UUID is the abbreviation of Universally Unique Identifier, and the Chinese meaning is universal unique identification code.

3. MAC Address< /p>

4. OPEN UDID

5. Advertising identifier (IDFA-identifierForIdentifier)

6. Vindor identifier (IDFV-identifierForVendor)

Vendor is the first two parts of CFBundleIdentifier (reverse DNS format). Applications from the same operator running on the same device have the same value for this attribute; applications from different operators running on the same device have different values.

After testing, as long as there is a tencent app on the device, the identifierForVendor value will not change after reinstallation. If all tencent apps are deleted, the identifierForVendor value will change after reinstallation.

Unfortunately, all of the above identifiers that represent unique device numbers are either prohibited from use in IOS7, or the identifiers obtained twice after reinstalling the program are different.

Since the data stored in the IOS system is in the sandBox, once the App is deleted, the sandBox will no longer exist. Fortunately, there is an exception, and that is the keychain.

Normally, IOS systems use NSUserDefaults to store data information, but for some private information, such as passwords, certificates, etc., a more secure keychain needs to be used.

The information saved in the keychain will not be lost when the App is deleted. Therefore, you can use this keychain feature to save the unique identification of the device.

So, how to use keyChain in the application? We need to import Security.framework. The keychain operation interface is declared in the header file SecItem.h.

To directly use the method in SecItem.h to operate the keychain, the code you need to write is more complicated. We can use the encapsulated tool class KeychainItemWrapper to operate the keychain.

KeychainItemWrapper is an encapsulation class for accessing common keychain operations in Apple's official example "GenericKeychain". After downloading the GenericKeychain project from the official website,

You only need to add "KeychainItemWrapper.h" and Copy "KeychainItemWrapper.m" to our project and import Security.framework.

Usage of KeychainItemWrapper:

/** Initialize a KeychainItemWrapper that saves user accounts */

KeychainItemWrapper *wrapper = [[KeychainItemWrapper alloc] initWithIdentifier:@"Account Number"

accessGroup:@"YOUR_APP_ID_HERE.com.yourcompany.AppIdentifier"];

//Save data

[wrapper setObject:@"" forKey:(id) kSecAttrAccount];

[wrapper setObject:@"" forKey:(id)kSecValueData];

//Retrieve the account password from the keychain

NSString *password = [wrapper objectForKey:(id)kSecValueData];

//Clear settings

[wrapper resetKeychainItem];

The method "- ( The value of the parameter "forKey" in void)setObject:(id)inObject forKey:(id)key;" should be the key defined in the header file "SecItem.h" in Security.framework. Using other strings as the key program will cause errors. !