DerekSelander / LLDB

A collection of LLDB aliases/regexes and Python scripts to aid in your debugging sessions
GNU General Public License v2.0
1.77k stars 198 forks source link

ios 14.2 xcode 12.2 keychain error #30

Open BigCatGit opened 3 years ago

BigCatGit commented 3 years ago

(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 commented 3 years ago

问题已解决:

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