Reputation: 2775
Say my app has sensitive data and I want to ensure the user authenticates locally via Passcode before accessing it. I'm using the Xamarin TouchID authentication with iOS 8 as seen in this Xamarin intro to touch ID article. I tested this out on an older device that was running iOS 7 and it obviously didn't work. So my question is, how can I do passcode authentication with iOS 7 devices? Is this only available with iOS 8?
I've noticed the iOS app Mint uses a custom Passcode. How do you implement a custom passcode that is connected to the "Enter Passcode" button in the TouchID popup? If I knew how to do that I could implement my own custom passcode so that it works for iOS 7...
Upvotes: 2
Views: 1843
Reputation: 8741
You cannot use Touch ID with iOS 7.
To use a custom passcode just catch the LAErrorUserFallback error in evaluatePolicy.
LAContext *context = [[LAContext alloc] init];
[context evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics
localizedReason:@"Your Text" reply:^(BOOL success, NSError *error) {
if(success) {
// handle success
} else {
NSString *failureReason;
switch (error.code) {
case LAErrorUserFallback:
// show your custom passcode screen
break;
}
}
}];
The code obviously needs to be finished, you need to also handle all the other error cases.
Upvotes: 2