Device ID
一、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的更多相关文章
- otg device id pin 探討
Platform : Qualcomm MSM8937 PMIC : Qualcomm PMI8940 OTG base on USB2.0,增加 device 可當 host 也可當 periphe ...
- Android Unique Device ID
There are several occasions when the unique identifier of a device is required. For instance you nee ...
- Alternative to iPhone device ID (UDID)
Alternative to iPhone device ID (UDID) [duplicate] up vote10down votefavorite 3 Possible Duplicate:U ...
- android device ID获取
Android Device ID是Android用户在Google认证过手机的设备唯一标识,当然国内很多Android手机没有经过Google认证,所以一般没有Google官方Android de ...
- STM32唯一ID(Unique Device ID)的读取方法
每一个STM32微控制器都自带一个96位的唯一ID,也就是Unique Device ID或称为UID,这个唯一ID在任何情况下都是唯一的且不允许修改. 在开发过程中,可能需要用到这个UID,比 ...
- 什么是Device ID?
Android ID用于唯一识别一部设备的一次刷机行为,虽然不能完全确定该设备的唯一性(真的唯一性是用IMEI号的),但是可以很大程度上过滤重复设备.这是移动互联网广告行业的基础,尤其是CPI广告,设 ...
- UNIX文件的权限之“设置用户ID位”
用stat函数可以获取一个文件的状态信息,原型是这样的: int stat(const char *path, struct stat *buf); 其中结构体stat的结构: struct stat ...
- [转]com.devicepush.cordova-phonegap Device Push Notification Plugin
本文转自:https://www.npmjs.com/package/com.devicepush.cordova-phonegap Device Push Notification Plugin D ...
- Android 系统ID介绍
Android上系统ID有很多,本文只介绍常用的ANDROID ID.DEVICE ID.IMEI/MEID.WIFI/BT ADDRESS等几个,本文介绍这些ID的数据格式.长度及一些基本知识. 一 ...
随机推荐
- SPEL语言-Spring Expression Language
Spring表达式语言全称为"Spring Expression Language",缩写为"SpEL",类似于Struts 2x中使用的OGNL表达式语言,能 ...
- HashMap两种遍历数据的方式
HashMap的遍历有两种方式,一种是entrySet的方式,另外一种是keySet的方式. 第一种利用entrySet的方式: Map map = new HashMap(); Iterator i ...
- .net4.5 await async 简化之后的异步编程模型
步骤核心: 方法签名包含一个 async 修饰符. 按照约定,异步方法的名称以“Async”后缀结尾. 返回类型为以下之一: Task<TResult> 如果您的方法有操作数为 TRes ...
- POJ3687 Labeling Balls(拓扑排序\贪心+Floyd)
题目是要给n个重量1到n的球编号,有一些约束条件:编号A的球重量要小于编号B的重量,最后就是要输出字典序最小的从1到n各个编号的球的重量. 正向拓扑排序,取最小编号给最小编号是不行的,不举出个例子真的 ...
- POJ3254 Corn Fields(状压DP)
题目给个n×m的地图,1可以放玉米0不可以,现在要放玉米,玉米上下左右不能相邻,问放法有几种. 当前一行的决策只会影响下一行,所以状压DP之: dp[i][S]表示前i行放完且第i行放玉米的列的集合是 ...
- ZOJ 3913 Bob wants to pour water ZOJ Monthly, October 2015 - H
Bob wants to pour water Time Limit: 2 Seconds Memory Limit: 65536 KB Special Judge There i ...
- Remainder
Remainder Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total S ...
- Dijkstra堆优化与SPFA模板
Dijkstra+优先队列 #include<cstdio> #include<cctype> #include<queue> #include<cstrin ...
- RN组件之ViewPagerAndroid
一.ViewPagerAndroid 1.一个允许在子视图之间左右翻页的容器.每一个ViewPagerAndroid的子容器会被视作一个单独的页,并且会被拉伸填满 ViewPagerAndroid.注 ...
- c++ <string.h>中包括哪些常用函数
常用函数如下:strlen 求字符串长度strcmp 比较2个字符串是否一样strcat 字符串连接操作strcpy 字符串拷贝操作strncat ...