作者:Lyn-风 | 来源:互联网 | 2023-05-19 00:17
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 个解决方案