Haseeb Iqbal
Haseeb Iqbal

Reputation: 1725

ViewController is not displayed on screen after pushViewController but it is present in UI-Debugger

After getting an AppLink, i am pushing VC on navigationController. ViewController does not appear on screen and app is frozen (not crashed). But if i open UI-Debugger, VC is there.

I tried to execute the link on Main, it makes the issue rare but is still reproducible sometimes.

DispatchQueue.main.async {
    navController?.pluginNavigationController.pushViewController(viewController, animated: true)
}

Any idea?

Upvotes: 0

Views: 309

Answers (1)

Haseeb Iqbal
Haseeb Iqbal

Reputation: 1725

It can be irrelevant for many but might help someone.

In my case ViewController is implementing UIGestureRecognizerDelegate and I was returning true from

gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool

even if there was 1 ViewController on NavigationStack. This caused app to freeze ( actually next time when i tried to pushViewController with animation, UI got stuck in animation forever).

(In addition to my other checks) Adding following check at the end of method fixed the issue.

return navigationController.viewControllers.count > 1

Upvotes: 1

Related Questions