iPhone4 SecItemCopyMatching 重启后返回 -25300

标签 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上我没有这个问题,工作完美。 你能帮我吗?

抱歉我的英语不好。

最佳答案

错误25300errSecItemNotFound,这意味着您的钥匙串(keychain)中没有这样的项目。

关于iPhone4 SecItemCopyMatching 重启后返回 -25300,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11538150/

相关文章:

ios - 将 NSUrl 更改为 QLPreviewItem

python - 如何证明 Python 是安全的

python - python 程序如何检查自己的 md5sum?

ios - 数据源更改后动态重新加载 UIPageViewController

ios - 使用 Assets 时如何在 Xcode 5 中关闭图标光泽效果?

iphone - 尝试从 iOS 中的另一个类中提取属性

iphone - 在 dismissModalViewControllerAnimated 之后调用 presentModalViewController 有问题

iphone - 检测 iPhone 主屏幕上的应用程序

iphone - 为 UIWebView 添加模型层(带缓存); UIWebViewNavigationType 和 shouldStartLoadWithRequest 的问题

android - 如何从远程设备访问(如 TeamViewer)隐藏 Android 应用程序