重启后iPhone4 SecItemCopyMatching返回-25300

时间:2012-07-18 09:22:00

标签: iphone security ios5

我的方法:

+(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;
}

直到我重新启动iPhone4才能正常工作。在此SecItemCopyMatching返回错误代码-25300并且我的应用程序停止正常工作。在iPhone3上我没有这个问题,只是工作完美。 你能救我吗?

对不起我的英文。

1 个答案:

答案 0 :(得分:3)

错误25300errSecItemNotFound,这意味着您的钥匙链中没有此类商品。

相关问题