什么是iOS 7中UDID或UUID的副本 [英] what is the replica for UDID or UUID in iOS 7

查看:102
本文介绍了什么是iOS 7中UDID或UUID的副本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题是,一旦我生成 UUID 它为我工作。但是如果我/用户删除应用程序而不是 UUID 与之前生成的不一样。如果我们使用uuid作为标识符,那么这里没有唯一性。请帮我解决这个问题。如果重新安装应用程序,我怎样才能获得相同的uuid或任何字符串。
提前致谢..

Problem is once I am generating UUID its working for me. But if me/user delete the application than UUID is not same like i have generated before. There is no uniqueness here if we are using uuid as identifier. Please help me to solve this issue.How can i get same uuid or any string if application reinstalled. Thanks in advance..

我正在使用这种方法:

NSString *udid;

if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"6.0"))
    udid = [UIDevice currentDevice].identifierForVendor.UUIDString;
else
    udid = [UIDevice currentDevice].uniqueIdentifier;


推荐答案

首先,查看NSHiplster上这篇内容丰富的帖子 http://nshipster.com/uuid-udid-unique-identifier/

First, check this very informative post on NSHiplster http://nshipster.com/uuid-udid-unique-identifier/

这应该适合你:

NSString *UUIDString = nil;
if ([[UIDevice currentDevice].systemVersion floatValue] >= 6.0) {
    UUIDString = [[NSUUID UUID] UUIDString];
} else {
    CFUUIDRef UUID = CFUUIDCreate(NULL);
    UUIDString = CFBridgingRelease(CFUUIDCreateString(NULL, UUID));
}

这篇关于什么是iOS 7中UDID或UUID的副本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆