Add Dependent library Localauthentication.framework
#import <LocalAuthentication/LocalAuthentication.h>//Header files
Lacontext *context = [[Lacontext alloc] init];
Nserror *error = nil;
This code is to let the fingerprint verification of the prompt box did not enter the password
Context.localizedfallbacktitle = @ "";
if ([Context Canevaluatepolicy:lapolicydeviceownerauthenticationwithbiometrics Error:&error]) {
[Context evaluatepolicy:lapolicydeviceownerauthenticationwithbiometrics localizedreason:@ "use fingerprint verification to unlock the app" reply:^ ( BOOL success, Nserror * _nullable error) {
if (success) {//validation succeeded
Fingerprint unlock is performed on a sub-thread, you need to go back to the main thread when you want to refresh the UI, or you will see the interface card die
Dispatch_async (Dispatch_get_main_queue (), ^{
Self.dactylogramLbl.text = Self.dactylogramSwitch.on? @ "Fingerprint verification is turned on": @ "Fingerprint verification is not turned on";
[Kuserdefaults setBool:self.dactylogramSwitch.on forkey:@ "Isopenfingerprintpwd"];
});
} else {
if (Error.code = = Klaerrorusercancel) {//Click Cancel
NSLog (@ "Verification failed 3");
} else {
NSLog (@ "Verification failed 2");
}
} else {
NSLog (@ "Your device cannot use TouchID for authentication");
Uialertview *alertview = [[Uialertview alloc] initwithtitle:@ "Prompt" message:@ "Your device cannot use TouchID for authentication" delegate:self cancelbuttontitle:@ "determine" otherbuttontitles:nil];
[Alertview show];
}
IOS9 Integrated fingerprint Unlocking