SSKeyChain 下载链接: http://pan.baidu.com/s/1booV3VD 密码: ivdi

/**

*  获取设备唯一标识 uuid

*/

+(NSString*) uuid {

//保存一个UUID字符串到钥匙串:

CFUUIDRef uuid = CFUUIDCreate(NULL);

assert(uuid != NULL);

CFStringRef uuidStr = CFUUIDCreateString(NULL, uuid);

[SSKeychain setPassword: [NSString stringWithFormat:@"%@", uuidStr]

forService:@"com.liukena.ios.JiuyierNutrition"account:@"user"];

//从钥匙串读取UUID:

NSString *uuidString = [JYEDeviceInfo getDeviceId];

//注意“JYEDeviceInfo”是类名,替换成相应的类名即可。。(+ (NSString *)getDeviceId,本身是类方法,需要类名调用)

//    NSLog(@"[NSString getDeviceId] = %@",uuidString);

return uuidString;

}

+ (NSString *)getDeviceId

{

NSString * currentDeviceUUIDStr = [SSKeychain passwordForService:@" "account:@"uuid"];

if (currentDeviceUUIDStr == nil || [currentDeviceUUIDStr isEqualToString:@""])

{

NSUUID * currentDeviceUUID  = [UIDevice currentDevice].identifierForVendor;

currentDeviceUUIDStr = currentDeviceUUID.UUIDString;

currentDeviceUUIDStr = [currentDeviceUUIDStr stringByReplacingOccurrencesOfString:@"-" withString:@""];

currentDeviceUUIDStr = [currentDeviceUUIDStr lowercaseString];

[SSKeychain setPassword: currentDeviceUUIDStr forService:@" "account:@"uuid"];

}

return currentDeviceUUIDStr;

}

获取设备唯一标识 uuid(采用第三方库SSKeychain)的更多相关文章

  1. DeviceUuidFactory【获取设备唯一标识码的UUID(加密)】【需要运行时权限的处理的配合】

    版权声明:本文为HaiyuKing原创文章,转载请注明出处! 前言 有时需要对用户设备进行标识,所以希望能够得到一个稳定可靠并且唯一的识别码.虽然Android系统中提供了这样设备识别码,但是由于An ...

  2. iOS获取设备唯一标识的8种方法

    8种iOS获取设备唯一标识的方法,希望对大家有用. UDID UDID(Unique Device Identifier),iOS 设备的唯一识别码,是一个40位十六进制序列(越狱的设备通过某些工具可 ...

  3. ios开发——实用技术篇OC篇&获取设备唯一标识

    获取设备唯一标识 WWDC 2013已经闭幕,IOS7 Beta随即发布,界面之难看无以言表...,简直就是山寨Android. 更让IOS程序猿悲催的是,设备唯一标识的MAC Address在IOS ...

  4. IOS7如何获取设备唯一标识

    WWDC 2013已经闭幕,IOS7 Beta随即发布,界面之难看无以言表...,简直就是山寨Android. 更让IOS程序猿悲催的是,设备唯一标识的MAC Address在IOS7中也失效了. I ...

  5. 【转】 android获取设备唯一标识完美解决方案

    <p style="margin: 10px auto; padding-top: 0px; padding-bottom: 0px; color: rgb(51, 51, 51);  ...

  6. Android 获取设备唯一标识码

    概述 有时需要对用户设备进行标识,所以希望能够得到一个稳定可靠并且唯一的识别码.虽然Android系统中提供了这样设备识别码,但是由于Android系统版本.厂商定制系统中的Bug等限制,稳定性和唯一 ...

  7. iOS获取设备唯一标识的各种方法?IDFA、IDFV、UDID分别是什么含义?

    一.UDID (Unique Device Identifier) UDID的全称是Unique Device Identifier,顾名思义,它就是苹果IOS设备的唯一识别码,它由40个字符的字母和 ...

  8. android 获取设备唯一标识完美解决方案

    /** * deviceID的组成为:渠道标志+识别符来源标志+hash后的终端识别符 * * 渠道标志为: * 1,andriod(a) * * 识别符来源标志: * 1, wifi mac地址(w ...

  9. 获取Android设备唯一标识码

    概述 有时需要对用户设备进行标识,所以希望能够得到一个稳定可靠并且唯一的识别码.虽然Android系统中提供了这样设备识别码,但是由于Android系统版本.厂商定制系统中的Bug等限制,稳定性和唯一 ...

随机推荐

  1. 一些比较实用的javascript方法收集,留着有用

    动态加载javascript文件 <script type="text/javascript"> //<!-- /*动态加载方法*/ function loadS ...

  2. Session赋值(备注)

    Session赋值也是在后台赋,不是在前台赋 追问 不好意思 那还真能在AJAX中赋值 我已经解决了 加一个接口IRequiresSessionState 就OK 提问者评价 太感谢了,真心有用

  3. CC150 - 11.5

    Question: Given a sorted array of strings which is interspersed with empty strings, write a method t ...

  4. 【BZOJ】1603: [Usaco2008 Oct]打谷机(水题+dfs)

    http://www.lydsy.com/JudgeOnline/problem.php?id=1603 这种水题... dfs没话说.. #include <cstdio> #inclu ...

  5. 【wikioi】1904 最小路径覆盖问题(最大流+坑人的题+最小路径覆盖)

    http://wikioi.com/problem/1904/ 这题没看数据的话是一个大坑(我已报告官方修复了),答案只要求数量,不用打印路径...orz 最小路径覆盖=n-最大匹配,这个我在说二分图 ...

  6. OpenCV 2.4.10 Linux Qt Conifguration

    Download CMake 2.8.12 Extract the file, and run "./bootstrap", then "make", then ...

  7. itellyou MSDN, 我告诉你 win7系统工具等

    http://www.itellyou.cn/ 操作系统-window7-中文-Windows 7 Ultimate with Service Pack 1 (x64) - DVD (Chinese- ...

  8. Wilddog - 野狗常用知识点

    https://www.wilddog.com/examples/chat-var1 https://z.wilddog.com/web/quickstart 增加或者修改替换整条数据(注意,upda ...

  9. String数组转List,List转String数组

    引入自: http://blog.csdn.net/aaronuu/article/details/7055650 List 转换为 String数组 List<String> list  ...

  10. 1. Nginx

    参考: http://www.darrenfang.com/2014/02/install-php-with-nginx-on-ubuntu/   安装: apt-get install python ...