参考文章

一、CFUUID (Deprecated)

二、UDID (Deprecated)

三、NSUUID (ios6.0 and later)

NSString *uuid = [[NSUUID UUID] UUIDString];

  1) 每次调用都会返回不同的值。

四、Advertiser Identifier (ios6.0 and later)

NSString *adId = [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString];

  1) 需要 AdSupport.framework

  2) 除了以下情况会重新产生新的 id外,一般情况下是固定不变的。

    a> reset the system (Settings.app -> General -> Reset -> Reset All Content and Settings)

    b> 如果用户在 settings 选择了 "Limit Ad Tracking" on,会限制程序访问 Advertiser Identifier。

五、Identifier for vendor (ios6.0 and later)

NSString *idfv = [[[UIDevice currentDevice] identifierForVendor] UUIDString];

  1) 在同一个设备上,同 vendor 的 app 的此 id 是一样的。

  2) vendor is defined by the first two parts of the reverse DNS formatted CFBundleIdentifier.

    example

      com.doubleencore.app1 and com.doubleencore.app2    same

      com.massivelyoverrated or even net.doubleencore   different

  3) 如果用户把设备上 同一个 vendor 的 apps 都删除掉,下一次安装后此 id 会重新产生。

六、第三方的 OpenUDID(ios5.0 and later,不建议使用)

NSString *openUDID = [OpenUDID value];

  七、把 device id 存放到 system keychain,只有当设备 system restore 才会重置,而且keychain里保存的信息不会因App被删除而丢失。

    (apple demo “GenericKeychain”)

    1) 下载 apple 提供的 KeychainItemWrapper (如果使用的是 arc ,则需要标示 -fno-objc-arc)

    2)需要的框架:Security.framework

    3)使用

KeychainItemWrapper* keychainItem = [[KeychainItemWrapper alloc] initWithIdentifier:bundleID
accessGroup:nil];
// 读取
NSString* uuidStr = [keychainItem objectForKey: (id)kSecValueData]; // 写入
[keychainItem setObject:uuidStr forKey:(__bridge id)kSecAttrService];
[keychainItem setObject:uuidStr forKey:(id)kSecValueData];

  

Device ID的更多相关文章

  1. otg device id pin 探討

    Platform : Qualcomm MSM8937 PMIC : Qualcomm PMI8940 OTG base on USB2.0,增加 device 可當 host 也可當 periphe ...

  2. Android Unique Device ID

    There are several occasions when the unique identifier of a device is required. For instance you nee ...

  3. Alternative to iPhone device ID (UDID)

    Alternative to iPhone device ID (UDID) [duplicate] up vote10down votefavorite 3 Possible Duplicate:U ...

  4. android device ID获取

    Android  Device ID是Android用户在Google认证过手机的设备唯一标识,当然国内很多Android手机没有经过Google认证,所以一般没有Google官方Android de ...

  5. STM32唯一ID(Unique Device ID)的读取方法

    每一个STM32微控制器都自带一个96位的唯一ID,也就是Unique Device ID或称为UID,这个唯一ID在任何情况下都是唯一的且不允许修改.    在开发过程中,可能需要用到这个UID,比 ...

  6. 什么是Device ID?

    Android ID用于唯一识别一部设备的一次刷机行为,虽然不能完全确定该设备的唯一性(真的唯一性是用IMEI号的),但是可以很大程度上过滤重复设备.这是移动互联网广告行业的基础,尤其是CPI广告,设 ...

  7. UNIX文件的权限之“设置用户ID位”

    用stat函数可以获取一个文件的状态信息,原型是这样的: int stat(const char *path, struct stat *buf); 其中结构体stat的结构: struct stat ...

  8. [转]com.devicepush.cordova-phonegap Device Push Notification Plugin

    本文转自:https://www.npmjs.com/package/com.devicepush.cordova-phonegap Device Push Notification Plugin D ...

  9. Android 系统ID介绍

    Android上系统ID有很多,本文只介绍常用的ANDROID ID.DEVICE ID.IMEI/MEID.WIFI/BT ADDRESS等几个,本文介绍这些ID的数据格式.长度及一些基本知识. 一 ...

随机推荐

  1. (int &)a 和(int)a

      [cpp] view plain copy float a = 1.0f;     cout < < (int)a < < endl;     cout < < ...

  2. Visual Studio提示Bonjour backend初始化失败

    Visual Studio提示Bonjour backend初始化失败 错误信息:The Bonjour backend failed to initialize, automatic Mac Bui ...

  3. ARP缓存记录种类动态条目和静态条目

    ARP缓存记录种类动态条目和静态条目 为使广播量最小,ARP维护IP地址到MAC地址映射的缓存以便将来使用.根据缓存的有效期时间,ARP缓存中包含动态和静态条目本文选自ARP协议全面实战手册. 这里首 ...

  4. 一个工程两个target

    有很多的应用有两个版本,可能只是ui上有一些不同,维护两份代码是很麻烦的,这时候我们可以在已有的工程target上copy这个target来达到一份代码两个应用版本的需求 duplicate就可以co ...

  5. Linq to Sql/entity Join

      inner join 模板: var query = from x in db.T1             join y in db.T2             on x.Id equals ...

  6. html基本标签练习

    Alt  显示工具栏 f2修改文件名称 内联元素:<div>只占一行</div> 块级元素:<span></span> 以utf8无bom格式编码 安装 ...

  7. C#控制鼠标位置

    It is not possible using the .NET BCL. However if you really want it you can use native SetCursorPos ...

  8. ural 1243. Divorce of the Seven Dwarfs

    1243. Divorce of the Seven Dwarfs Time limit: 1.0 secondMemory limit: 64 MB After the Snow White wit ...

  9. jQuery 跨域访问问题解决方法(转)

    转自:http://www.jb51.net/article/21213.htm 浏览器端跨域访问一直是个问题, 多数研发人员对待js的态度都是好了伤疤忘了疼,所以病发的时候,时不时地都要疼上一疼.记 ...

  10. JS URL传中文参数引发的乱码问题

    今天的项目中碰到了一个乱码问题,从JS里传URL到服务器,URL中有中文参数,服务器里读出的中文参数来的全是“?”,查了网上JS编码相关资料得以解决. 解决方法一: 1.在JS里对中文参数进行两次转码 ...