8 Kinds of iOS get the device unique identification method, hope to be useful to everyone.
UDID
UDID (unique Device Identifier), the unique identifier of the IOS device, is a 40-bit hexadecimal sequence (the jailbroken device can change the device's UDID by some tools), and the mobile network can use UDID to identify the mobile device.
Many developers associate UDID with the user's real name, password, address, and other data, and the Web Snoop collects the data from multiple apps and then gets a lot of privacy data from the person, while most applications do transfer UDID and private information frequently. To avoid class action, Apple eventually decided to repeal the practice at IOS 5.
Now the app tries to get UDID has been banned and is not allowed to shelves.
MAC Address
MAC (Medium/media Access Control) address, which represents the identifier for each site on the Internet, is a six-byte (48-bit) hexadecimal sequence. The first three bytes are assigned to different manufacturers by the Registrar RA of the IEEE (organizationally unique Identifier), and the last three bytes are assigned to the production adapter interface by each manufacturer, called an extension identifier.
MAC addresses are used on the network to differentiate the uniqueness of the device, and the devices that access the network have a MAC address, and they are certainly unique. There may be multiple MAC addresses on an iPhone, including WiFi, SIM, and so on, but there's a WiFi connection on the ITouch and IPad, so just get the WiFi MAC address. Typically, MD5 (MAC address + Bundleid) is taken to obtain a unique identity.
But the MAC address and UDID, there is a privacy issue, after IOS 7, all device requests MAC address will return a fixed value, this method is also out of the question.
Openudid
After UDID was discarded, the vast majority of developers needed to look for an alternative UDID, and Apple-controlled solution, Openudid became the most widely used open source UDID alternative. Openudid uses a very ingenious method to store identifiers between different programs: A special name is used to store identifiers in the Pasteboard, and other applications can get them in this way.
Apple has restricted the pasteboard after IOS 7, resulting in the inability to share a single openudid between apps on the same device.
UUID + Own storage
UUID (Universally unique IDentifier), universal Unique identifier, is a 32-bit hexadecimal sequence that is connected using a small horizontal line: 8-4-4-4-12, via Nsuuid (after IOS 6) [Nsuuid UUID]. Uuidstring or Cfuuid (after IOS 2) cfbridgingrelease (cfuuidcreatestring (Kcfallocatordefault, Cfuuidcreate ( Kcfallocatordefault)), but each time you get a different value, you need to store it yourself.
Push token + Bundleid
The push token guarantees that the device is unique, but must have a network condition to work, which is not dependent on the device itself, but relies on Apple push, and apple push sometimes gets out of the way.
IDFA
Idfa-identifierforidentifier (ad identifier), all apps on the same device will get the same value, which is set by Apple to track the user with ads that are commercially available. Although the IPhone is allowed to be tracked by default and is not known by the general user, the user can reset the value of this ID in Settings-privacy-ad tracking, or limit the use of this ID, so it is possible that the value will not be taken.
Idfv
Idfv-identifierforvendor (Vendor identifier), obtained by [Uidevice currentdevice].identifierforvendor.uuidstring. is matched by the first two parts of the Bundleid reversal, if the same Vendor, for example Com.mayan.app_1 and com.mayan.app_2 two Bundleid, belong to the same Vendor, sharing the same IDF V, unlike IDFA, the value of IDFV must be taken, so it is well suited to identify users as the primary ID for internal user behavior analysis. However, if the user deletes the app, the IDFV value is reset and the app is installed again, and the IDFV value is different from the previous.
IDFV + Keychain
Through the above several storage unique identification method analysis, summarizes each has the merits and demerits. Many methods are banned by Apple or too many loopholes, more and more are not used by developers, now Apple main push IDFA and IDFV two methods, respectively, external and internal, but IDFV in the APP reinstall will change, so my method is through the first generation of IDFV storage into keychain, each later The secondary fetch identifier is obtained from the keychain.
8 ways iOS acquires a device's unique identity