David Gatti David Gatti - 8 days ago 12
Swift Question

Use of unresolved identifier 'LAContext' in Swift 3

Apple claims to have this class in their arsenal LAContext, but Xcode 8.1 tells me otherwise:

Use of unresolved identifier 'LAContext'


My line of code is as follows:



let context = LAContext()


To me this line of code doesn't seams to crazy ;), all the tutorial on-line make use of this no problem to check if TouchID is enabled, but in my Xcode, this is not the case.

What am I missing?

Answer

You need to import the LocalAuthentication framework which contains this class and other related functionality.

import LocalAuthentication