Ios 隐藏SecItemUpdate上的TouchId弹出窗口

Ios 隐藏SecItemUpdate上的TouchId弹出窗口,ios,objective-c,cocoa-touch,ios8,touch-id,Ios,Objective C,Cocoa Touch,Ios8,Touch Id,我在一些touchId应用程序中看到,在SecItemUpdate上,touchId UI屏幕从未弹出,更新仍在进行。我需要为我的应用程序提供类似的功能,根据我从《苹果开发者指南》(Apple Developer's guide)中读到的内容(我的理解可能是错误的),我提出了一些选项,但它们似乎不起作用。以下是我到目前为止所做的 将kSecUseNoAuthenticationUI设置为YES,将返回错误代码-25308。将kSecUseNoAuthenticationUI设置为NO,将返回错误

我在一些touchId应用程序中看到,在
SecItemUpdate
上,touchId UI屏幕从未弹出,更新仍在进行。我需要为我的应用程序提供类似的功能,根据我从《苹果开发者指南》(Apple Developer's guide)中读到的内容(我的理解可能是错误的),我提出了一些选项,但它们似乎不起作用。以下是我到目前为止所做的

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];
});]

所以我在这一点上迷路了。如果您能给我一些关于如何在SecItemUpdate上禁用此touchId UI弹出窗口的建议,我将不胜感激。谢谢

如果您看一下WWDC 2014年第711次会议的视频,
kSecUseNoAuthenticationUI
在31:35左右提到

您还可以在“SecItem.h”中查看:

我不确定您是否可以禁用弹出窗口并执行更新


我想理解的是:设置
kSecUseNoAuthenticationUI
选项将不会显示弹出窗口。但是,如果您试图访问一个需要身份验证的项目,它将通过返回一个
errSecInteractionNotAllowed
作为操作结果来指示该项目,从而失败根据iOS8发行说明,假设是这种情况,您应该删除并重新添加您的项目

if (status == errSecDuplicateItem) { // exists
      status = SecItemDelete((__bridge CFDictionaryRef)attributes);

      if (status == errSecSuccess) {
        status = SecItemAdd((__bridge CFDictionaryRef)attributes, nil);
      }
}

您可以在没有TouchID提示的情况下执行更新吗?我可以在没有提示的情况下执行更新。我将我的secItemAdd更改为“(\u桥id)kSecUseNoAuthenticationUI:@NO,(\u桥id)kSecAttrAccessible:(\u桥id)ksecattraccessibleewhenunlocked”,这似乎在更新时也修复了它。最初它被设置为“ksecattraccessiblewwhenPasscodesetThisDeviceOnly”,这导致在更新过程中弹出提示。您可以共享这些发行说明的链接吗?我看不出这有什么关系
if (status == errSecDuplicateItem) { // exists
      status = SecItemDelete((__bridge CFDictionaryRef)attributes);

      if (status == errSecSuccess) {
        status = SecItemAdd((__bridge CFDictionaryRef)attributes, nil);
      }
}