I have seen in some touchId apps where on SecItemUpdate
the touchId UI screen never pops up and the update still happens. I need similar functionality for my app and based on what I have read from Apple Developer's guide (my understanding maybe wrong) have come up with some options but they don't seem to work. Here's what I have done so far.
Setting kSecUseNoAuthenticationUI
to YES
, an error code -25308
is returned. Setting kSecUseNoAuthenticationUI
to NO
, an error code -50
is returned. If I don't include kSecUseNoAuthenticationUI
, then the default authentication UI pops up.
我在一些touchId应用中见过,SecItemUpdate会显示touchId UI屏幕,而更新仍然会发生。我的应用程序需要类似的功能,根据我从苹果开发者指南(我的理解可能是错误的)中读到的内容,我提出了一些选项,但似乎并不奏效。这是我到目前为止所做的。将kSecUseNoAuthenticationUI设置为YES,返回一个错误代码-25308。将kSecUseNoAuthenticationUI设置为NO,返回错误代码-50。如果不包含kSecUseNoAuthenticationUI,则会弹出默认的身份验证UI。
NSDictionary *query = @{(__bridge id)kSecClass: (__bridge id)kSecClassGenericPassword,
(__bridge id)kSecAttrService: @"SampleService",
(__bridge id)kSecUseNoAuthenticationUI: @YES
};
NSDictionary *changes = @{
(__bridge id)kSecValueData: [@"UPDATED_SECRET_PASSWORD_TEXT" dataUsingEncoding:NSUTF8StringEncoding]
};
dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
OSStatus status = SecItemUpdate((__bridge CFDictionaryRef)query, (__bridge CFDictionaryRef)changes);
NSString *msg = [NSString stringWithFormat:NSLocalizedString(@"SEC_ITEM_UPDATE_STATUS", nil), [self keychainErrorToString:status]];
[super printResult:self.textView message:msg];
});]
So I am lost at this point. Appreciate if you can give me some pointers on how to disable this touchId UI popup on SecItemUpdate. Thanks
所以我在这一点上迷失了。如果您能给我一些关于如何禁用这个touchId UI的提示,请在SecItemUpdate上给我一些提示。谢谢
2 个解决方案
#1
4
If you take a look at video WWDC 2014 Session 711, the kSecUseNoAuthenticationUI
is mentioned around 31:35.
如果你看一下视频WWDC 2014第711节,你会发现kSecUseNoAuthenticationUI在31:35左右。
You can look also in "SecItem.h" :
你也可以在“SecItem”中查找。h”:
@constant kSecUseNoAuthenticationUI Specifies a dictionary key whose value
is a CFBooleanRef. If provided with a value of kCFBooleanTrue, the error
errSecInteractionNotAllowed will be returned if the item is attempting
to authenticate with UI.
I'm not sure you can both disable the pop-up and perform an update.
我不确定您是否可以禁用弹出窗口并执行更新。
What I suppose to understand : setting the kSecUseNoAuthenticationUI
option will not display the pop-up. But if you 're trying to access to an item that requires an authentication, it will fail by indicating you that the item by returning a errSecInteractionNotAllowed
as the operation result
我想理解的是:设置kSecUseNoAuthenticationUI选项将不会显示弹出窗口。但是,如果您试图访问需要身份验证的项,它将失败,因为它将返回一个errSecInteractionNotAllowed作为操作结果,从而指示您该项
#2
1
According to the iOS8 release notes, this supposed is the case and you should delete and re-add your item
根据iOS8发布说明,应该是这样的,应该删除并重新添加项目
if (status == errSecDuplicateItem) { // exists
status = SecItemDelete((__bridge CFDictionaryRef)attributes);
if (status == errSecSuccess) {
status = SecItemAdd((__bridge CFDictionaryRef)attributes, nil);
}
}
#1
4
If you take a look at video WWDC 2014 Session 711, the kSecUseNoAuthenticationUI
is mentioned around 31:35.
如果你看一下视频WWDC 2014第711节,你会发现kSecUseNoAuthenticationUI在31:35左右。
You can look also in "SecItem.h" :
你也可以在“SecItem”中查找。h”:
@constant kSecUseNoAuthenticationUI Specifies a dictionary key whose value
is a CFBooleanRef. If provided with a value of kCFBooleanTrue, the error
errSecInteractionNotAllowed will be returned if the item is attempting
to authenticate with UI.
I'm not sure you can both disable the pop-up and perform an update.
我不确定您是否可以禁用弹出窗口并执行更新。
What I suppose to understand : setting the kSecUseNoAuthenticationUI
option will not display the pop-up. But if you 're trying to access to an item that requires an authentication, it will fail by indicating you that the item by returning a errSecInteractionNotAllowed
as the operation result
我想理解的是:设置kSecUseNoAuthenticationUI选项将不会显示弹出窗口。但是,如果您试图访问需要身份验证的项,它将失败,因为它将返回一个errSecInteractionNotAllowed作为操作结果,从而指示您该项
#2
1
According to the iOS8 release notes, this supposed is the case and you should delete and re-add your item
根据iOS8发布说明,应该是这样的,应该删除并重新添加项目
if (status == errSecDuplicateItem) { // exists
status = SecItemDelete((__bridge CFDictionaryRef)attributes);
if (status == errSecSuccess) {
status = SecItemAdd((__bridge CFDictionaryRef)attributes, nil);
}
}