0

I have very usual navigation controller and I can handle local notification. When local notification is firing, new viewController is creating and showing. So it's very common situation, when I push and pop (back button) controllers in standard behaviour, when suddenly in push or pop process, local notification is firing and new viewControllers is trying to appear and both fails. As the result - black screen, no responsive app. How to detect and prevent this collision? or should I use another approach?

NikLanf
  • 1,663
  • 1
  • 11
  • 14

1 Answers1

0

So firstly, some answers are here. But they don't work for me. So I ended up with just block UI for 1 second. It's not critical, but works as expected. If push (pop) animation is in process, then after 1 sec it will be done :

[[UIApplication sharedApplication] beginIgnoringInteractionEvents];
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        if ([lastStackVC.navigationController respondsToSelector:@selector(showViewController:sender:)]) {
            [lastStackVC.navigationController showViewController:vc sender:nil];
        } else {
            [lastStackVC.navigationController pushViewController:vc animated:YES];
        }
        [[UIApplication sharedApplication] endIgnoringInteractionEvents];
    });
NikLanf
  • 1,663
  • 1
  • 11
  • 14