ボタンのある外部デバイスがあります。このボタンを押すと、View Controller が切り替わります。ボタンをゆっくり押すと、うまく遷移します。しかし、ボタンを押す速度が速すぎると、アプリがクラッシュして次のエラーが表示されます。
Terminating app due to uncaught exception NSInternalInconsistencyException, reason: Attempting to begin a modal transition from <SViewController: (numbers)> to <VViewController: (numbers)> while a transition is already in progress. Wait for viewDidAppear/viewDidDisappear to know the current transition has completed
この問題を解決する方法がわかりません。これは、View Controller を切り替えるために使用するコードです。これを各View Controllerにif文を入れます(もちろんView Controllerを切り替えます):
if ([data isEqualToString: @"Switch1"]) {
UIStoryboard *sb = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle:nil];
UIViewController *vc = [sb instantiateViewControllerWithIdentifier:@"VViewController"];
vc.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentViewController:vc animated:YES completion:NULL];
}
このエラーは、viewDidLoad` をチェックインしviewDidLoad', but I have no idea what code to put in
て遷移が終了したかどうかを判断し、終了していない場合は再度遷移を試行しないようにすることを示しています。