IOS6 and how to identify different devices in the future

Source: Internet
Author: User

Typically, iOS systems use Nsuserdefaults to store data, but for some private information, such as passwords, certificates, and so on, you need to use a more secure keychain.

The information stored in the keychain is not lost due to the app being deleted. Therefore, this keychain feature can be used to preserve the unique identity of the device.

So, how to use keychain in the application, we need to import security.framework, Keychain operation Interface declaration in the header file SecItem.h.

Directly using the SecItem.h method to operate the keychain, the code needs to write more complex, we can use the already encapsulated tool class Keychainitemwrapper to operate on keychain.

Keychainitemwrapper is the Apple official example "Generickeychain" in a keychain common operation of the package class, after downloading the Generickeychain project on the official website,

Just copy the "KeychainItemWrapper.h" and "KEYCHAINITEMWRAPPER.M" to our project and import the Security.framework. (xcode5 keychainitemwrapper.m to remove the automatic reference count )

    nsmutablestring *str1 =[nsmutablestring string];//    keychainitemwrapper *keychainitem = [[ Keychainitemwrapper alloc] initwithidentifier:@ "UUID" accessgroup:@ "com.itrun.www"];//    [Keychainitem resetkeychainitem];//    //    NSString *uuidstr = [Keychainitem objectforkey: (__bridge ID) ksecvaluedata];//    if (Uuidstr.length = = 0) {        //Unique identifier generated place        nsstring *myuuidstr = [[Uidevice currentdevice] Identifierforvendor] uuidstring];//        [Keychainitem setobject:myuuidstr forkey: (__bridge ID) ksecvaluedata];//        str1 = myUUIDStr;//    }//    else{//        str1 = [Keychainitem objectforkey: (__bridge ID) ksecvaluedata];//    }//    MyLog (@ "======%@", str1);    050BBA53-7388-4CFF-991D-FEB548065CDF    //5023a8e8-233f-4391-b119-2234996537e9

However, when the IOS8 debugging, the error occurs.



To identify a user, the first option is to select an identifier that identifies the user's device (not the user), which guarantees that the value returned on one device is the same, and that the same value does not appear on other devices.

Before IOS7, there had been many ways to identify the user's device, from the most original device Udid, MAC address, to an open source solution widely used by the ad statistics platform Openudid.

But as AppStore starts rejecting applications that use Udid, the MAC address returns the same value on all devices on the iOS7, and the restrictions on the Clipboard on iOS7, resulting in openudid not being able to share the same value with different apps. The above-mentioned IDs were doomed to leave the stage of history.

With IOS7 quickly taking over half of the time, the control of the device ID is finally back in Apple's hands, allowing users to take control of their privacy, fully demonstrating Apple's determination to protect users ' privacy.

Well, here's one question:What do we use to track and identify users in the iOS7 era?

Give the conclusion first
    • IDFA: For external use: such as advertising, exchange, and other cross-application user tracking
    • IDFV: For internal use: For example, analyzing user behavior within the app, etc.

PS: The dust settles, follow the Apple Walk, everybody no longer hesitate.

Explain IDFA again.
  • Full Name: Advertisingidentifier
  • Code:

      #import <AdSupport/AdSupport.h>  NSString *adId = [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString];
  • Source: iOS6.0 and later

  • Description: Literal translation is the advertising ID, all apps on the same device will get the same value, is Apple specifically for each ad to provide commercial to track users, users can in settings | privacy | AD tracking to reset the value of this ID, or limit the use of this ID, Therefore, the ID may not be able to get the value, but fortunately Apple is allowed to track by default, and the general user does not know that there is such a setting, so basically used to monitor the promotion effect, is more than stamp.
  • Note: Since IDFA will not be available, it should never be used as the main ID for business analysis to identify users.
Idfv
  • Full Name: Identifierforvendor
  • Code:

      NSString *idfv = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
  • Source: iOS6.0 and later

  • Description: As the name implies, is to vendor identity users, each device in the same vender application, all have the same value. The vender refers to the application provider, but to be exact, it is matched by the first two parts of the Bundleid DNS reversal, if the same is the same vender, for example, for Com.somecompany.appone, Com.somecompany.apptwo These two bundleid, they belong to the same vender, sharing the value of the same IDFV. Unlike IDFA, the value of IDFV can be taken, so it is well suited to identify the user as the primary ID for internal user behavior analysis, instead of Openudid.
  • Note: If the user uninstalls all apps that belong to this vender, the IDFV value will be reset, that is, the APP,IDFV value of this vender will be re-installed before the values are different.
The Heroes of History Udid

Device Unique identifier (unique device Identifier) before being a variety of domestic and foreign statistical platforms, application developers widely used, after Apple since May 01, 2013 refused to accept the use of UDID application, stand up!

MAC address

Each network card has a unique identity, that is, the MAC address, it is clearly used to identify a mobile phone is more than enough, there are some open source scheme also used it, domestic umtrack and so also used it as a master ID, with iOS7 return the same value, have to retire to the lake.

Openudid

After Apple refused to Udid, Openudid as an independent Apple-based open source program, was accepted by the vast number of developers, the major statistical advertising platform from Udid and other programs to switch to Openudid program (it seems that everyone does not want to be completely bound by Apple), but unfortunately, Also due to IOS7 's limitations on the Clipboard, the ability to share a single openudid on the same device can no longer be shared, that is, openudid is significantly weakened as a device's unique identity. You can also see that with the advent of iOS7, the advertising platform to quickly update their SDK, to switch to Apple's IDFA scheme.

Other

Cfuuid, Nsuuid and other self-generated, their own storage management is not elaborate.

Devicetoken

This is a push token, if the user does not push, or refused, this is not!


IOS6 and how to identify different devices in the future

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.