Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions YYKit/Utility/YYKeychain.m
Original file line number Diff line number Diff line change
Expand Up @@ -434,17 +434,22 @@ + (YYKeychainItem *)selectOneItem:(YYKeychainItem *)item error:(NSError **)error
status = SecItemCopyMatching((__bridge CFDictionaryRef)query, &result);
if (status != errSecSuccess) {
if (error) *error = [[self class] errorWithCode:status];
if (result) {
CFRelease(result);
}
return nil;
}
if (!result) {
return nil;
}
if (!result) return nil;

NSDictionary *dic = nil;
if (CFGetTypeID(result) == CFDictionaryGetTypeID()) {
dic = (__bridge NSDictionary *)(result);
} else if (CFGetTypeID(result) == CFArrayGetTypeID()){
dic = [(__bridge NSArray *)(result) firstObject];
if (![dic isKindOfClass:[NSDictionary class]]) dic = nil;
}
CFRelease(result);
if (!dic.count) return nil;
return [[YYKeychainItem alloc] initWithDic:dic];
}
Expand Down