LLDB icon indicating copy to clipboard operation
LLDB copied to clipboard

ios 14.2 xcode 12.2 keychain error

Open BigCatGit opened this issue 4 years ago • 1 comments

(lldb) keychain error: warning: <user expression 31>:15:5: collection expression type 'NSArray *' may not respond to 'countByEnumeratingWithState:objects:count:' for (id secItemClass in secItemClasses) { ^ ~~~~~~~~~~~~~~ error: <user expression 31>:18:9: unknown type name 'CFTypeRef' CFTypeRef result = NULL; ^ error: <user expression 31>:19:39: use of undeclared identifier 'CFDictionaryRef' SecItemCopyMatching((__bridge CFDictionaryRef)query, &result); ^ warning: <user expression 31>:60:13: collection expression type 'NSArray *' may not respond to 'countByEnumeratingWithState:objects:count:' for (id dsitem in keychainArray) { ^ ~~~~~~~~~~~~~

BigCatGit avatar Dec 24 '20 05:12 BigCatGit

问题已解决:

NSArray secItemClasses = @[(id)@"genp", / kSecClassGenericPassword / (id)@"inet", / kSecClassInternetPassword / (id)@"cert", / kSecClassCertificate / (id)@"keys", / kSecClassKey / (id)@"idnt", / kSecClassIdentity */ ];

NSMutableArray *returnArray = [NSMutableArray new];
for (int i = 0; i < [secItemClasses count]; i++) {
    id secItemClass = secItemClasses[i];
    [query setObject:secItemClass forKey:(id)@"class"];
    
    void* result = NULL;
    SecItemCopyMatching((__bridge struct __CFDictionary *)query, &result);
    
    NSArray *keychainArray = (__bridge id _Nullable)(result);
    NSDictionary * (^grabContents)(NSDictionary *) = ^NSDictionary* (NSDictionary *dict) {

BigCatGit avatar Dec 24 '20 07:12 BigCatGit