获取 Keychain returns NSArray 的属性

Getting attributes of Keychain returns NSArray

我想获取钥匙串属性的字典,但我得到了一个 NSArray,其中包含 NSDictionary 的 1 个元素。这是我获取属性的代码:

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);

这是来自控制台的一些信息

为什么 retNSArray 类型?

queryDictionary[(__bridge id)kSecMatchLimit] = (__bridge id)kSecMatchLimitOne;

已修复!