Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ios 14.2 xcode 12.2 keychain error #30

Open
BigCatGit opened this issue Dec 24, 2020 · 1 comment
Open

ios 14.2 xcode 12.2 keychain error #30

BigCatGit opened this issue Dec 24, 2020 · 1 comment

Comments

@BigCatGit
Copy link

(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
Copy link
Author

问题已解决:

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant