简体   繁体   English

允许Face ID权限警报

[英]Allow Face ID permission alert

My app (running in iPhone X Simulator Xcode 9.0.1) is asking me for permission to use Face ID. 我的应用程序(在iPhone X Simulator Xcode 9.0.1中运行)要求我允许使用Face ID。

The alert says: 警报说:

Do you want to allow <appName> to use Face ID? This app was designed to use Touch ID and may not fully support Face ID.

I was expecting that the few changes I made to the new APIs in the LocalAuthentication framework (eg biometryType ) was supposed to basically work for Face ID. 我期待,我在新的API做了一些改动LocalAuthentication框架(如biometryType )本来基本上是面部识别工作。

Is there something else I need to do to make it so my app is designed to fully support Face ID? 有没有别的东西,我需要做的,做起来很我应用程序旨在全面支持面部识别?

It appears that you need to add the NSFaceIDUsageDescription to your Info.plist in order to support Face ID. 您似乎需要将NSFaceIDUsageDescription添加到Info.plist以支持Face ID。

Also, the simulator alert is only for simulator, without that Info.plist key, the app apparently should crash on a real device without it. 此外,模拟器警报仅适用于模拟器,没有Info.plist键,应用程序显然应该在没有它的真实设备上崩溃。

Thanks to these dudes for helping me learn this - What is NSFaceIDUsageDescription - Face ID Usage Description Info.plist key? 感谢这些帮助我学习这些的人 - 什么是NSFaceIDUsageDescription - 面部ID使用说明Info.plist键?


Protip: 专家提示:

Prior to the permission prompt, [LAContext canEvaluatePolicy:error:] returns YES for biometrics if the device is capable of it. 在权限提示之前, [LAContext canEvaluatePolicy:error:]如果设备能够YES生物识别,则返回YES

iOS won't prompt the user for permission until the first call to [LAContext evaluatePolicy:localizedReason:reply:] . 在第一次调用[LAContext evaluatePolicy:localizedReason:reply:]之前,iOS不会提示用户授予权限。

If the user does not grant permission, then all future calls to canEvaluatePolicy will return NO (error Code=-6 "User has denied the use of biometry for this app."). 如果用户授予权限,则以后对canEvaluatePolicy所有调用canEvaluatePolicy将返回NO (错误代码= -6“用户已拒绝对此应用程序使用生物统计。”)。 This is an odd nuance. 这是一个奇怪的细微差别。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM