Tag: sfhfkeychainutils

iOS SFHFKeychainUtils失败*有时*错误-25308 errSecInteractionNotAllowed

我有这个代码从给定的用户名NSString的钥匙串获取密码: NSError *error = nil; NSString *appName = [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString*)kCFBundleNameKey]; NSString *pw = [SFHFKeychainUtils getPasswordForUsername:username andServiceName:appName error:&error]; if(error != nil) // log the error 大多数用户大多数时候这一切都工作正常 – 但对于一些特定的用户,这个调用似乎失败(并继续失败),它返回以下错误: The operation couldn't be completed. (SFHFKeychainUtilsErrorDomain error -25308.) 这显然是errSecInteractionNotAllowed – 从我读过的,我认为这意味着需要访问钥匙串的某种用户交互。 有没有人有任何想法,为什么这个电话可能会失败的一些特定的用户只? 这个钥匙串条目是特定于我的应用程序 – 那么为什么需要任何用户交互来访问它? 任何指针赞赏…

SFHFKeychainUtils。 iOS钥匙串。 ARC兼容

我想知道是否有人使用SFHFKeychainUtils设法修改它们与ARC兼容。 更确切地说, NSDictionary *attributeResult = NULL; NSMutableDictionary *attributeQuery = [query mutableCopy]; [attributeQuery setObject: (id) kCFBooleanTrue forKey:(__bridge id) kSecReturnAttributes]; OSStatus status = SecItemCopyMatching((CFDictionaryRef) attributeQuery,(CFTypeRef *)(attributeResult)); 我试过了 OSStatus status = SecItemCopyMatching((__bridge CFDictionaryRef) attributeQuery,(CFTypeRef *)(attributeResult)); 也 CFTypeRef subAttributeResult = (CFTypeRef *)(objc_unretainedPointer(attributeResult)); OSStatus status = SecItemCopyMatching((__bridge CFDictionaryRef) attributeQuery,(CFTypeRef *)(subAttributeResult)); 这2是我设法得到没有错误的唯一的两种方法。 任何其他方法通过添加objc_XXX而不是CFTypeRef在这里和那里得到我的错误(从obj-c指针到CFTypeRef的隐式转换在ARC中被禁止,将xparameter passing给y参数丢弃限定符)。 显然,第一段代码也会给出错误。 尽pipe在构build时我没有遇到任何错误,但是在到达这部分代码时,应用程序与EXC_BAD_ACCESS一起崩溃。 完整的SFHFKeychainUtils链接: https : //github.com/ldandersen/scifihifi-iphone/tree/master/security 请帮忙吗? […]