There are many ways to get the unique identity of a device on an iOS system:
1. x UDID (Unique Device Identifier, expired )
2. x OPEN UDID (expired)
3. Advertising identifiers (Idfa-identifierforidentifier)
4. Vendor identifiers (Idfv-identifierforvendor)
5. Push Device token+bundle_id
6. UUID (Universally Unique Identifier)
7. x MAC address (all acquired MAC addresses are the same after IOS 7)
1. x UDID
Udid's full name is unique device Identifier, which is the unique identifier of the Apple iOS device, which consists of 40 characters of letters and numbers (jailbroken devices can change the device's Udid by some tools). Mobile networks can use UDID to identify mobile devices, but since IOS5.0 (August 2011), Apple has announced that it will no longer support the use of the uniqueidentifier method to obtain the udid,ios5 of the device below. On March 21, 2013 Apple has informed developers that, from May 1, 2013 onwards, the program to access Uidids will no longer be approved, and the alternative is that developers should use the "vendor or advertising identifiers described in iOS 6". So Udid is absolutely useless.
2. x OPEN UDID (expired)
OPEN UDID, does not use the MAC address, but also can ensure that different applications on the same device use the same openudid, as long as the user device has a use of openudid application exists, other subsequent installation of the application if the acquisition Openudid, Will get the one that was generated by the first app. However, according to the code and methods of the contributors, and some developers experience, if the use of the Openudid scheme of applications are all deleted, and then regain Openudid, at this time the Openudid is not the same as before. Visible, this method is still not insurance. This project has expired.
3. Advertising identifiers (Idfa-identifierforidentifier)
The ad identifier, another new method in iOS 6, provides a method for Advertisingidentifier, which returns a Nsuuid instance by calling the method, and finally obtains a UUID that is stored by the system. However, even though this is stored by the system, there are several cases where the ad identifier is regenerated. This ad identifier is regenerated if the user completely resets the system (restore location and privacy, general-purpose, Setup, and so on). In addition, if the user explicitly restores the ads (set-up, general-purpose, and so on, to the ads, and restore the ad identifiers), then the ad identifiers will be regenerated. With respect to the restoration of the ad identifier, it is important to note that if the program is running in the background, the user "restores the ad identifier" and then goes back to the program, and then gets the ad identifier and does not immediately get the restored identifier. You must terminate the program before restarting the program to obtain the restored AD identifier.
4. Vendor identifiers (Idfv-identifierforvendor)
The vendor identifier, also added in iOS 6, is the same as Advertisingidentifier, which returns a Nsuuid object that can get a UUID. If the condition "same program inside-same vendor-same device" is met, then the property value obtained will not change. This value will not be the same if it is "the same program-the same device-different vendor, or the same program-different devices-whether or not the same vendor" is the case.
Ways to push token+bundle_id:
- Add push to get token in app
- Get app bundle_id
- Hash operations based on token+bundle_id
5. Push Device token+bundle_id
Apple 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.
This token explanation is not very detailed, from the various analysis found on the Internet, the conclusion is that the number is basically stable, that is, the reload application will not change. However, the system is not determined after the upgrade. For example, rising from iOS4 to IOS5 is said to change. It is also said that the token is valid for only two years. In addition, Apple officially elaborated:"an application should register [with APN servers] every time it launches and give its provider the Curre NT token ". Since Apple has suggested this, it also proves that this token is not suitable for use as a device identification.
6. UUID (Universally Unique Identifier)
UUID is universally unique identifier abbreviation, Chinese meaning is universal unique identification code. It is to allow all the elements in the distributed system to have unique identification information, and do not need to through the central control side to do the identification information designation. In this way, everyone can create a UUID that does not clash with others. In this case, there is no need to consider the name duplication problem when the database is established. Apple recommends using a UUID to generate a unique identification string for your app.
The code for getting the UUID in iOS is as follows:
-(nsstring*) UUID { Cfuuidref puuid = cfuuidcreate (nil); Cfstringref uuidstring = cfuuidcreatestring (nil, puuid); NSString * result = (NSString *) cfstringcreatecopy (NULL, uuidstring); Cfrelease (puuid); Cfrelease (uuidstring); return [result autorelease]; }
The developer can call once at the first launch of the app and then store the string for later use instead of Udid. However, if the user deletes the app and then installs again, a new string is generated, so it is not guaranteed to uniquely identify the device. This requires all the experts to come up with a variety of solutions. So, many applications have been using Mac Address before. But now if users upgrade to IOS7 (and later Apple systems), their MAC address is the same, there is no way to differentiate, only discard this method, re-use the UUID to identify. If you use the UUID, consider the processing when the app is removed and then reinstalled.
One solution is that the UUID is typically generated only once, saved in iOS keychain, and if the app is removed, its UUID is the same after the reload, unless the system resets.
There are several projects to do this:
Https://github.com/fabiocaccamo/FCUUID
Http://blackpixel.com/blog/2012/03/unique-identifier-is-dead-long-live-unique-identifier.html (https:// Github.com/blackpixel/bpxluuidhandler)
Https://github.com/ObjColumnist/MCSMKeychainItem
Reference blog:
Http://www.cnblogs.com/BigPolarBear/p/3359526.html
Http://iosameer.blogspot.fr/2012/08/alternative-to-ios-device-uuid.html
Http://www.cnblogs.com/samniu/p/3673781.html
http://www.cocoachina.com/bbs/read.php?tid=144524
Http://www.cnblogs.com/smileEvday/p/udid.html
Various identification codes for IOS