Date
Sep. 8th, 2024
 
2024年 8月 6日

Post: LAContext.biometryType returns LABiometryType.none in iOS 11

LAContext.biometryType returns LABiometryType.none in iOS 11

Published 12:12 Dec 18, 2017.

Created by @ezra. Categorized in #Programming, and tagged as #iOS.

Source format: Markdown

Table of Content

I'm trying to support FaceID in my application.

Running LAContect().canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &error) returns true, so I expect that the device has biometrics enabled (which it has, it is an iPhone X with iOS 11.2.1 with FaceID enrolled and working for unlock).

So I expect to get LABiometryType.typeTouchID when later checking LAContext.biometryType, but as the title says it returns LABiometryType.none.

Auctully, we need to first call canEvaluatePolicy... in order to get the biometry type. That is, if you're just doing LAContext().biometryType then you'll always get none back. You would first need to call canEvaluatePolicy... on that instance, and then biometryType should have a non-none value (assuming the device has biometry support, and the user has enabled it).

Pinned Message
HOTODOGO
The Founder and CEO of Infeca Technology.
Developer, Designer, Blogger.
Big fan of Apple, Love of colour.
Feel free to contact me.
反曲点科技创始人和首席执行官。
程序猿、设计师、奇怪的博主。
苹果死忠、热爱色彩斑斓的世界。
如有意向请随时 与我联系