[Discussion on unique identification of]ios device

Source: Internet
Author: User

Transferred from: http://www.jianshu.com/p/b83b0240bd0e

Exploring the unique identity of iOS devices

To count and detect the usage data for the application, almost every company has a business need to obtain a unique identity, and a unique identification prior to IOS5 can be obtained to the system-provided method Udid (unique Device Identifier). It was later banned by Apple for reasons of user privacy. So, everyone started using MAC addresses in iOS6 (Medium/media Access Control), which was later banned by Apple officials in IOS7. Apple and its foreign IT companies will pay more attention to user privacy, so the next one but a more reliable way to get the only signs out, Apple will definitely block.

On a non-jailbroken phone to obtain a hardware information to generate a unique identity, the first to find the vulnerability of Apple, the second is to call some private interface, obviously these two roads are more difficult, not sustainable development, so the most unique logo on the internet is obtained from the operating system level, when resetting the phone system will be cleared, In the system upgrade, unloading load, backup recovery can be preserved, and now I have not found that can use the strict sense of the unique identity. The next thing I want to talk to you about is how to get the "only sign" that doesn't change easily by "legal" means.

What do mobile statistics platforms use to identify devices?
This paper studies the SDK of two major mobile statistics platforms in China and TalkingData.
Friends of the league with a Openudid +IDFA
TalkingData with a Keychain +IDFA

Openudid

Openudid is an open source project on GitHub: Address
The principle is to use the Clipboard class in the iOS system UIPasteboard , which uses app-special pastboards to store 1160-bit random strings that are accessed in a way similar to the dictionary's key-value. app-special pastboards can persist strings, even when switching, uninstalling, and sharing between apps. Openudid first visit with key to check if there is a corresponding value (random number) in the Clipboard, if it does not exist to generate one and stored in the Pasteboard, the second access can be directly taken without generating a new random number.
But after iOS7, Apple blocked the vulnerability of the Clipboard communication , before iOS is all apps can share the same clipboard storage content, now only under the same cfbundleidentifier identity of the app to share content, such as COM.KOUDAI.A and COM.KOUDAI.B, their com.mycompany part is the same, can be shared (please use the real machine test, the simulator will be biased).

Keychain

The keychain Chinese translation is a keychain, an encrypted storage area used by Apple to store passwords and certificates, to help users securely store applications or browser passwords, eliminating the hassle of entering passwords and remembering passwords. Keychain is not stored in the cell phone's sandbox, but is a common area of the phone, the phone restart and application uninstall, will not affect the storage area, because there is no encrypted storage is modified by other applications, so someone took Keychain to store a unique identity.
Access to Keychian on Max OS requires a user's login password, while on iOS users can only access the keychain of the App Store, unless they are two applications of the same provisioning certificate, For example, the group's cat's eye can be read in the Keychian app, the first time the user opened the cat's Eye app will pop-up prompts, users can read the U.S. group's account and password to enter the cat's eye. Keychain is based on the provision certificate to authenticate permissions, so the app version needs to use the same, otherwise the version will be invalidated. When the user restores the factory settings, the keychain on the machine is cleared, but the contents of the keychain storage are still valid if the phone is backed up beforehand. By the way, keychain can be exported on a jailbreak machine, so encrypt it before storing sensitive information.

Nsuuid

The last section keychain to solve the problem of storage, what to save to ensure that each device ID is unique? Most applications have a UUID, which is a way to get large random numbers after Apple re-iOS6. UUID, the global Independent logo (globally Unique Identifier), according to the wiki, the UUID random number algorithm obtained a number of repetition probability of 17 billion, one of 17 billion points what concept? Can tell you to buy a note color Ball's winning probability is one of 17 million points. There are several sets of random algorithms, including timestamps, MD5 and so on, Apple is following the RFC 4122 version 4, you can go to Google.

NSString *uuid = [[NSUUID UUID] UUIDString];

Each call to this method will definitely have a different uuid, so you must use persistent storage.

IDFA

Idfa This is another new method in iOS 6, is a Asidentifiermanager singleton in the Adsupport.framework Framework provides a method for Advertisingidentifier, which returns a Nsuuid instance by calling the method. The ad identifier is also stored by the system, and the reset will be restored in the settings of the restore system and the restore ad identifier, such as the Set program, general, and so on. Apple limits the use of IDFA, and apps that use IDFA but do not integrate with any AD service will be rejected, and IDFA in the app must be set up in the upload page in itunes Connect, or an error will occur when uploading an app audit.

Of course there are many other IDs can be used to identify the device, I mentioned in the article is only a relatively reliable method, if let me choose, I will use Keychain storage Nsuuid method, after all, a user reset system is a small probability event, Even if someone really wants to forge a user volume to do a system reset at a very high cost. If you have a better way to get the unique identifier of your iOS device, you might want to leave a message.

Reference Link: http://www.cocoachina.com/industry/20130422/6040.html

[Discussion on unique identification of]ios device

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.