background
The advertisingIdentifier documentation sees this:
Important
In iOS 10.0 and later, the value of advertisingIdentifier is all zeroes when the user has limited ad tracking.
Copy the code
In other words, on iOS10, if the user turns on the restricted AD tracking, the idfa will be a string of 00000000-0000-0000-0000-000000000000
SimulateIDFA is an MD5 value generated from a bunch of device information (each app gets the same value). Used to mark different equipment.
Use:
Framework dependencies:
- CoreTelephony.framework
Import simulateIDfa. h and Simulateidfa. m files
Call the code where SimulateIDFA is needed:
NSString *simulateIDFA = [SimulateIDFA createSimulateIDFA];
Copy the code
The format of simulateIDFA is the same as that of IDFA
626363D0-90D4-06BF-C281-384E4E69D3E2
Copy the code
The generated MD5 value consists of two parts.
Take 626363D0-90D4-06BF-C281-384e4E69D3e2 as an example:
The first 16 bits of 626363D0-90D4-06bf are obtained from a more stable parameter combination, and the first 16 bits will only change when the system is upgraded.
The last 16-bit C281-384E4E69D3e2 is generated by a combination of parameters that can be easily changed, with a more common value change being system restart.
- The parameters involved in the calculation of the first 16 bits are:
System version (9.3.2), hardware information (N53AP,iPhone6,2, China mobile 46002,1048576000), coreServices file creation and update time (2015-08-07 23:53:00 +0000,2016-06-07) 23:53:09 +0000), system capacity (12266725376)Copy the code
There are some information that will change during the upgrade, such as system version, coreServices file creation and update time, and system capacity
- The parameters involved in the last 16-bit calculation are:
System startup time (1473301191 minus the following four digits 147330), country code (CN), local language (zh-Hans-CN), device name (XXXX)Copy the code
The parameters here are relatively easy to change, the system restart after 10000 seconds from the last restart will change, other parameters can be modified in the Settings
SimulateIDFA was compared with OpenIDFA
OpenIDFA is an open source library by Yann Lechelle. It is the replacement scheme of IDFA
Let’s say we have a situation. Ten million (10 million) devices of the same model are upgraded to the same system in one country in one day.
- SimulateIDFA
The possible values of this algorithm in a day, 24×3600 (file creation time, in seconds) x 10 (file last modification time, assuming error within 10 seconds) x 10000000 (system capacity error range) x 9000000(device name range, It is assumed that there are 2 duplicates for every 10, and the name range is 10000000X0.9)= 77760000000000000000.
If the value of device A is K, the probability that the value of device B is both K is 1/77760000000000000000. There are 10 million devices in total. Therefore, the probability that one of the 10000000 devices has the same value K as device A is 1/77760000000000000000 x 10000000 = 1/7776000000000.
- OpenIDFA
Take a look at the algorithm for generating OpenIDFA, which is MD5 for the following combination of parameters.
System startup time (1473241127 minus the last four digits is 147324), system capacity (29230571520), system version (9.3.4), model (N78AP,iPod5,1), country code (CN), local language (zh-hans-cn), some pre-installed apps (due to using canOpenURL interface, IOS9 is dead), time zone (Asia/Shanghai), time of day (160804, August 4, 2016, this value is the reason why it changes every day)Copy the code
The possible value in one day is the error of system capacity (10000000). Ps: The system startup time has no effect on the reduction of the repetition rate in this case, because OpenIDFA is calculated by subtracting the last 4 bits of the system startup time. The same goes for the time of day.
The value of device A is K, so the possibility that the value of device B is both K is 1/10000000. There are 10 million devices in total. Therefore, the probability that one of the 10000000 devices has the same value K as device A is 1/10000000 x 10000000 = 1
Timeliness comparison
- OpenIDFA
You get different values every day
- SimulateIDFA
SimulateIDFA is divided into two parts. The first 16 bits will change when the system is upgraded, and some behaviors of the last 16 bits may change the value (such as restarting the phone, modifying the device name, and modifying the phone’s local language).
OpenIDFA has some limitations. The generated IDFA changes daily and has a high repetition rate under extreme conditions. SimulateIDFA performs better in this respect