嗨我遇到了一个奇怪的行为,我真的不明白。应用程序在调用performSegue里面Touch ID块后停止
我向用户展示了一个触摸ID标识,如果他被授权我调用[self performSegueWithIdentifier:@“callCustomSegue”sender:self]; 这样块内:
[myContext evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics
localizedReason:myLocalizedReasonString
reply:^(BOOL success, NSError *error) {
if (success) {
[self performSegueWithIdentifier: @"callCustomSegue" sender:self];
然后该应用停止若干秒(至少3-4)然后下一个的ViewController被呈现。
的执行由“callCustomSegue”叫做到这一点:
- (void) perform {
src = (UIViewController *) self.sourceViewController;
dst = (UIViewController *) self.destinationViewController;
[src.view addSubview:dst.view];
}
我不明白发生了什么触摸ID的识别和performSegueWithIdentifier 为什么应用程序停止之间发生的事情。
如果我忽略了touch ID,并且只是像我期望的那样调用performSegueWithIdentifier立即工作。
如果我把在触摸ID块:
[myContext evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics
localizedReason:myLocalizedReasonString
reply:^(BOOL success, NSError *error) {
if (success) {
authenticated = YES;
[self showMessage:@"Authentication is successful" withTitle:@"Success"];
}
其中showMessage做到这一点:
UIAlertController * alert= [UIAlertController
alertControllerWithTitle:title
message:message
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* cancel = [UIAlertAction
actionWithTitle:@"OK"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action)
{
[alert dismissViewControllerAnimated:YES completion:nil];
if (authenticated) {
[self performSegueWithIdentifier: @"callCustomSegue" sender:self];
}
if (!authenticated) {
[self touchID];
}
}];
攻OK之后的下一个视图控制器立即调用。
所以问题是:为什么我不能在touch ID块中调用performSegue并获得立即响应?
任何想法,我错了吗?
非常感谢。
感谢名单了这么多,我只是学到新的东西给我。再次感谢你,完美无瑕。 – Fabrizio 2014-10-30 11:45:26