我从Stack Overflow上获取了一些访问Web浏览器密码的代码。只要密码在登录钥匙串中,它就可以很好地工作。但是,我感兴趣的特定帐户在某个时候被移动到iCloud钥匙串中,并且不再存在于登录钥匙串中。SecItemCopyMatching找不到它。它返回OSStatus -23500,即“未找到项目”。我如何访问这些条目?
CFArrayRef result = NULL;
NSDictionary *params = @{ (__bridge id)kSecClass : (__bridge id)kSecClassInternetPassword,
(__bridge id)kSecMatchLimit : (__bridge id)kSecMatchLimitAll,
(__bridge id)kSecReturnAttributes : (__bridge id)kCFBooleanTrue,
(__bridge id)kSecAttrProtocol : (__bridge id)kSecAttrProtocolHTTPS,
(__bridge id)kSecAttrServer : @"accounts.mydomain.com"
};
OSStatus status = SecItemCopyMatching((__bridge CFDictionaryRef)(params), (CFTypeRef *) &result);
if (status == noErr) {
// item found!
}