The person has to go up account from be born to begin, obtain an id card number thereby, from now on this id card number ruyingsuixing, tie together with this person forever, never separate again. Some procedures, do not recognize the number of people, because this id number is the only, and people may change, such as plastic surgery and other means, so judge whether this person, id number is a relatively good means.

Similarly, a unique device identifier is particularly important if a device is to have an accurate judgment and to know whether it is the same device. Unique identifiers in iOS go through the following phases.

IMEI

International Mobile Equipment Identity (IMEI) : International Mobile device Identity (IMEI). It is a unique number assigned to a Mobile phone after it is assembled. The dual-card dual-standby mobile phone has two communication chips, equivalent to two mobile phones inside a mobile phone shell. Each communication chip needs to be identified by IMEI, so dual-card dual-standby mobile phone has two communication chips, but generally the API provided by the system obtains the fixed one.

IOS2.0 provides a way to obtain IMEI, but after iOS5.0, it is not allowed to obtain IMEI, otherwise it will not pass the audit when it is put on the shelves.

UDID

UDID: Unique Device Identifier (UDID) of an iOS Device. It is prohibited in iOS6.

Now if you want to get the UDID/IMEI, you can get it from Safari+mobileConfig.

IDFA

Identifier for Identifier (IDFA) is an advertising Identifier. It is used for tracking users’ advertisements and is the unique ID of each device. IDFA is stored in the user’s system. Apple doesn’t allow developers to track users’ devices, but in order to monitor advertising, iOS 6 offers a compromise. The acquisition method is as follows:

    NSString *idfa = nil;
    ASIdentifierManager * adManage = [ASIdentifierManager sharedManager];
    if (adManage.advertisingTrackingEnabled) {
        idfa = adManage.advertisingIdentifier.UUIDString;
    }
    return idfa;
Copy the code

However, IDFA can also change, such as resetting the system, restoring the AD identifier, etc. At the same time, users can also choose whether to prohibit advertising tracking, operation path:Settings - Privacy - Ads - Limit AD tracking. What is returned after limiting AD tracking isnil. Before iOS14, it was off by default, and the whole system was managed in a unified way. After iOS14, each APP is applied separately, which is turned on (restricted) by default. The attribution logic through IDFA is roughly as follows:

The MAC address

Medium/Media Access Control (Mac) : indicates the physical address of a network device. If the IMEI is the unique identifier of the device, the Mac is the unique identifier of the network interface. The Mac address obtained after iOS7 is a fixed value: 02:00:00:00 00:00:00:00. The acquisition method is as follows:

#include <sys/sysctl.h> #include <sys/socket.h> #include <net/if.h> #include <net/if_dl.h> + (NSString *)getMacAddress {  int mib[6]; size_t len; char *buf; unsigned char *ptr; struct if_msghdr *ifm; struct sockaddr_dl *sdl; mib[0] = CTL_NET; mib[1] = AF_ROUTE; mib[2] = 0; mib[3] = AF_LINK; mib[4] = NET_RT_IFLIST; if ((mib[5] = if_nametoindex("en0")) == 0) { printf("Error: if_nametoindex error\n"); return NULL; } if (sysctl(mib, 6, NULL, &len, NULL, 0) < 0) { printf("Error: sysctl, take 1\n"); return NULL; } if ((buf = malloc(len)) == NULL) { printf("Could not allocate memory. error! \n"); return NULL; } if (sysctl(mib, 6, buf, &len, NULL, 0) < 0) { printf("Error: sysctl, take 2"); free(buf); return NULL; } ifm = (struct if_msghdr *)buf; sdl = (struct sockaddr_dl *)(ifm + 1); ptr = (unsigned char *)LLADDR(sdl); NSString *outstring = [NSString stringWithFormat:@"%02X:%02X:%02X:%02X:%02X:%02X", *ptr, *(ptr+1), *(ptr+2), *(ptr+3), *(ptr+4), *(ptr+5)]; free(buf); return outstring; }Copy the code

OpenUDID

OpenUIDI is by the open source library [OpenUDID] (https://github.com/ylechelle/OpenUDID) generated by the identification number. It does not depend on Mac addresses and can play the role of udiDs in the past. However, if you completely delete all apps with the open source library, the ID will be regenerated and will be different from the previous value, equivalent to a new device. Unfortunately, because of the clipboard restrictions in iOS7, the library is also deprecated.

UUID

Universally Unique IDentifier (UUID) : indicates the Universally Unique IDentifier. The acquisition method is as follows:

[NSUUID UUID]
Copy the code

The value will change each time you get it, but it will remain unique.

IDFV

IDFV (Identity FierforVendor) : Vendor identifier, also known as Vendor identifier. As long as all the apps of the current Vendor are not uninstalled on the user’s device, the change will not occur. The acquisition method is as follows:

[[[UIDevice currentDevice] identifierForVendor] UUIDString]
Copy the code

In general, vender is determined by the data provided by the App Store. If the installed App is not downloaded from the App Store, such as through an Enterprise package or a debug package installed through Xcode, vender is calculated from the bundle ID of the App. This bundle ID complies with the reverse-DNS rule. In iOS6 and before, the first two digits of the bundle ID are used to generate the vender ID, or the entire bundle ID if the bundle ID is a separate string. In iOS7 and later, the vender ID is generated using the non-last bit of the bundle ID, or the entire bundle ID if the bundle ID is a separate string. See the following table for details:

bundle ID iOS 6.x iOS 7.x
com.example.app1 com.example.app1 com.example.app1
com.example.app2 com.example.app2 com.example.app2
com.example.app.app1 com.example.app.app1 com.example.app.app1
com.example.app.app2 com.example.app.app2 com.example.app.app2
example example example
As shown in the table above, com.example.app1 and com.example.app2 have the same vender ID.

Au ID number

Trusted ID can be used as a benchmark identification of device uniqueness. Different from IMEI,MAC, serial number of Android and IDFA of iOS system, it is more difficult to tamper with, does not change with Rom and other changes, real-time identification of virtual machine environment, etc., perfectly compatible with Android 10 and iOS14 platforms.

SKAdNetwork

SKAdNetwork is a solution that allows AD platforms to track user clicks and installs without obtaining IDFA. Because Of Apple’s intervention, it will be directly across the device and the App Store, and will not reveal any device information to advertisers, and will be easier to prevent cheating. The principle is as follows:

However, the application scenarios of SKAdNetwork are relatively simple. Currently, it is mainly used to promote attribution.

reference

  • IOS Device ID past and present
  • Number of au
  • WWDC20 First round – IDFA access adjustment
  • SKAdNetwork
  • OpenUDID
  • AdSupport
  • Talk about the technical principle of trusted ID
  • IOS Obtains the UDID and IMEI of a device