我很难用这个:
我们的应用程序使用TouchID从KeyChain中检索用于在WKWebView中对WebApp进行身份验证的机密.当用户使用TouchID成功进行身份验证时,一切正常.
当用户使TouchID失败然后点击“输入密码”以通过设备密码进行身份验证时,就会出现问题.我注意到呈现的屏幕是纯白色,并且密码文本框不会显示输入的最后一个字符的值,直到它被屏蔽,从而产生奇怪的用户体验.这对我来说似乎是个错误,除非我在某种程度上错过了配置要求.
// global arguments for the touchId keychain queries
let kSecClassValue = NSString(format: kSecClass)
let kSecAttrAccountValue = NSString(format: kSecAttrAccount)
let kSecValueDataValue = NSString(format: kSecValueData)
let kSecClassGenericPasswordValue = NSString(format: kSecClassGenericPassword)
let kSecAttrServiceValue = NSString(format: kSecAttrService)
let kSecMatchLimitValue = NSString(format: kSecMatchLimit)
let kSecReturnDataValue = NSString(format: kSecReturnData)
let kSecMatchLimitOneValue = NSString(format: kSecMatchLimitOne)
let kSecAttrAccessControlValue = NSString(format: kSecAttrAccessControl)
let kSecUseOperationPromptValue = NSString(format: kSecUseOperationPrompt)
// set access control
let accessControl = SecAccessControlCreateWithFlags(kCFAllocatorDefault,
kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly, .UserPresence, nil)
// Instantiate a new default keychain query
// Tell the query to return a result
// Limit our results to one item
var keychainQuery: NSMutableDictionary = NSMutableDictionary(objects: [kSecClassGenericPasswordValue, service, userAccount, kCFBooleanTrue, kSecMatchLimitOneValue, "Place your finger to authenticate.", accessControl.takeUnretainedValue()], forKeys: [kSecClassValue, kSecAttrServiceValue, kSecAttrAccountValue, kSecReturnDataValue, kSecMatchLimitValue, kSecUseOperationPromptValue, kSecAttrAccessControlValue])
var dataTypeRef :Unmanaged<AnyObject>?
// Search for the keychain item
touchIdStatusCode = SecItemCopyMatching(keychainQuery, &dataTypeRef)
这是生成的keychainQuery字典:
{
"accc" = "<SecAccessControlRef: 0x170621140>";
"acct" = “MY_ACCOUNT”;
"class" = genp;
"m_Limit" = "m_LimitOne";
"r_Data" = 1;
"svce" = “MY_SERVICE”;
"u_OpPrompt" = "Place your finger to authenticate.";
}
此行为存在于最新的iOS版本(8.4)上.这是我所指的屏幕:
我的问题是:我是否以某种方式导致屏幕被我调用TouchID的方式打破?或者这种情况完全正常吗?
谢谢,对于冗长的帖子感到抱歉!
最佳答案 描述的问题是Apple工程师确认的错误.从iOS 9.0.2开始,它仍然存在.