0
我想知道當用戶沒有打開iOS 7上的iCloud Keychain支持(iOS默認?)時會發生什麼情況,然後運行以下代碼,然後開啓iCloud Keychain支持。數據已存儲後,鑰匙串icloud支持?
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;
先前存儲的「DeviceUUID」數值數據將被使用,或者鑰匙扣完全刪除。因此,返回值將是空的(用下面的代碼)和我會失去什麼之前存儲發生的一切?
KeychainItemWrapper* keychain = [[KeychainItemWrapper alloc] initWithIdentifier:@"com.joseandro.UUID" accessGroup:nil];
NSString* UUID = [keychain objectForKey:(kSecValueData)];
return UUID;