热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

数据存储后的钥匙串icloud支持?-Keychainicloudsupportafterdatahasalreadybeenstored?

IwonderwhatsgoingtohappenwhentheuserhasntturnedontheiCloudKeychainsupport(theiOS

I wonder what's going to happen when the user hasn't turned on the iCloud Keychain support (the iOS default?) on iOS 7 and then, the following code is ran and after that, the iCloud Keychain support is turned on.

我想知道当用户在iOS 7上没有打开iCloud Keychain支持(iOS默认?)时会发生什么,然后运行以下代码,之后启用iCloud Keychain支持。

    KeychainItemWrapper* keychain = [[KeychainItemWrapper alloc] initWithIdentifier:@"com.joseandro.UUID"  accessGroup:nil];

    CFUUIDRef theUUID = CFUUIDCreate(NULL);
    CFStringRef string = CFUUIDCreateString(NULL, theUUID);
    CFRelease(theUUID);

    NSString* UUID = [(NSString *)string autorelease];

    [keychain setObject:@"UNIQUE_IDS_SERVICE" forKey:kSecAttrService];
    [keychain setObject:@"DeviceUUID" forKey:kSecAttrAccount];
    [keychain setObject:UUID forKey:kSecValueData];
    [keychain setObject:kSecAttrAccessibleAlwaysThisDeviceOnly forKey:kSecAttrAccessible];

    [keychain release];
    keychain = nil;

The previously stored "DeviceUUID" value data is going to be used, or the Keychain is completely erased so the returned value would be empty (with the following code) and the I'd lose what was stored before all that to happen?

将使用先前存储的“DeviceUUID”值数据,或者完全擦除Keychain,因此返回的值将为空(使用以下代码)并且在所有发生之前我将丢失所存储的内容?

   KeychainItemWrapper* keychain = [[KeychainItemWrapper alloc] initWithIdentifier:@"com.joseandro.UUID"  accessGroup:nil];

   NSString* UUID = [keychain objectForKey:(kSecValueData)];
   return UUID;

1 个解决方案

#1


0  

It doesn't matter when the iCloud Keychain support is turned on, the key is always going to be there once it's stored.

打开iCloud Keychain支持并不重要,一旦存储密钥,密钥总是存在。

I just couldn't verify the behavior when the iCloud hasn't been activated and the OS is erased and installed back again.

当iCloud尚未激活且操作系统被删除并再次安装时,我无法验证行为。


推荐阅读
author-avatar
Lyn-风
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有