我想获得一个Keychain属性字典,但我得到一个NSArray
,其中包含1个NSDictionary
元素。这是获取属性的代码:
NSMutableDictionary *queryDictionary = [KeychainQueryDictionaryWithServiceAndIdentifier(serviceName, identifier) mutableCopy];
queryDictionary[(__bridge id)kSecReturnAttributes] = (__bridge id)kCFBooleanTrue;
queryDictionary[(__bridge id)kSecMatchLimit] = (__bridge id)kSecMatchLimitAll;
CFDictionaryRef result = nil;
OSStatus status = SecItemCopyMatching((__bridge CFDictionaryRef)queryDictionary, (CFTypeRef *)&result);
if (status != errSecSuccess) {
NSLog(@"Unable to fetch account info with identifier \"%@\" (Error %li)", identifier, (long int)status);
return nil;
}
id ret = (NSDictionary *)CFBridgingRelease(result);
这是来自控制台的一些信息
为什么ret
是NSArray
类型?
答案 0 :(得分:0)
queryDictionary[(__bridge id)kSecMatchLimit] = (__bridge id)kSecMatchLimitOne;
修正了它!