指纹支付按home 键不退出 走这个错 

2016-08-30  本文已影响132人  大虾咪

最近同学张 发现指纹支付的时候按Home键  不退出应用    测试发现是这样子的

//home 键不退出  走这个错                                alert.message=@"System cancelled authentication";

代码如下:

UIAlertView*alert = [[UIAlertViewalloc]initWithTitle:@""message:@""delegate:selfcancelButtonTitle:@"Okay"otherButtonTitles:nil,nil];

LAContext*myContext = [[LAContextalloc]init];

myContext.localizedFallbackTitle=@"ssssr";

NSError*authError =nil;

NSString*myLocalizedReasonString =@"Restricted Area!";

if([myContextcanEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometricserror:&authError]) {

[myContextevaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics

localizedReason:myLocalizedReasonString

reply:^(BOOLsuccess,NSError*error) {

if(success) {

// User authenticated successfully, take appropriate action

alert.title=@"Success";

alert.message=@"You have access to private content!";

[alertshow];

}else{

// User did not authenticate successfully, look at error and take appropriate action

alert.title=@"Fail";

switch(error.code) {

caseLAErrorUserCancel:

alert.message=@"Authentication Cancelled";

break;

caseLAErrorAuthenticationFailed:

alert.message=@"Authentication Failed";

break;

caseLAErrorPasscodeNotSet:

alert.message=@"Passcode is not set";

break;

caseLAErrorSystemCancel:

//home 键不退出   走这个错                                 alert.message=@"System cancelled authentication";

break;

caseLAErrorUserFallback:

alert.message=@"You chosed to try password";

break;

default:

alert.message=@"You cannot access to private content!";

break;

}

[alertshow];

}

}];

}else{

// Could not evaluate policy; look at authError and present an appropriate message to user

alert.title=@"Warning";

if(authError.code==LAErrorTouchIDNotEnrolled) {

alert.message=@"You do not have any fingerprints enrolled!";

}elseif(authError.code==LAErrorTouchIDNotAvailable) {

alert.message=@"Your device does not support TouchID authentication!";

}elseif(authError.code==LAErrorPasscodeNotSet){

alert.message=@"Your passcode has not been set";

}

[alertshow];

}

上一篇下一篇

猜你喜欢

热点阅读