嗨我遇到了一個奇怪的行爲,我真的不明白。應用程序在調用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