iPhone4 SecItemCopyMatching returns -25300 after reboot

こ雲淡風輕ζ 提交于 2019-12-24 04:03:07

问题


My method:

+(SecKeyRef)getKeyByTagWithoutAlert:(NSString *)keyTag status:(OSStatus *) status{
    *status = noErr;
    SecKeyRef key = NULL;

    NSMutableDictionary *queryKey = [[NSMutableDictionary alloc] init];

    // Set the key query dictionary.
    [queryKey setObject:(id)kSecClassKey forKey:(id)kSecClass];
    [queryKey setObject:[SecKeyUtility getDataByTag:keyTag] forKey:(id)kSecAttrApplicationTag];
    [queryKey setObject:(id)kSecAttrKeyTypeRSA forKey:(id)kSecAttrKeyType];
    [queryKey setObject:[NSNumber numberWithBool:YES] forKey:(id)kSecReturnRef];

    *status = SecItemCopyMatching((CFDictionaryRef)queryKey, (CFTypeRef *)&key);

    [queryKey release];
    return key;
}

And it works fine until I restart my iPhone4. After this SecItemCopyMatching returns error with code -25300 and my app stoping work properly. On iPhone3 I don't have this problem, just work perfect. Can you help me?

Sorry for my english.


回答1:


Error 25300 is errSecItemNotFound, which means that there is no such item in your key chain.



来源:https://stackoverflow.com/questions/11538150/iphone4-secitemcopymatching-returns-25300-after-reboot

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!