小编Sim*_*ast的帖子

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    
Run Code Online (Sandbox Code Playgroud)

对于大多数用户来说,这一切都可以正常工作 - 但是对于某些特定用户来说,这个调用似乎失败了(并且继续失败),它返回以下错误:

The operation couldn’t be completed. (SFHFKeychainUtilsErrorDomain error -25308.)
Run Code Online (Sandbox Code Playgroud)

这显然是errSecInteractionNotAllowed - 从我读过的内容来看,我认为这意味着要访问钥匙串需要某种用户交互.

有没有人知道为什么这个电话可能只对某些特定用户失败?此钥匙串条目特定于我的应用程序 - 那么为什么需要任何用户交互才能访问它?

任何指针都非常赞赏......

keychain ios sfhfkeychainutils

30
推荐指数
2
解决办法
1万
查看次数

为什么带有限制的rails中的查询不起作用,除非.all被放在最后

我有这样的查询:

locations = Location.order('id ASC').limit(10)
Run Code Online (Sandbox Code Playgroud)

返回一个包含500个左右记录的数组 - 表中的所有记录 - 即limit子句被忽略.

然而,如果我把.all放在最后:

locations = Location.order('id ASC').limit(10).all
Run Code Online (Sandbox Code Playgroud)

它工作并返回10条记录.

这个代码是在rake任务中运行的,如果这有任何不同,我正在使用PostgreSQL.

它为什么这样做?当然不应该要求.all.我错过了什么?

rake activerecord ruby-on-rails

10
推荐指数
1
解决办法
7422
查看次数