From 223e259951cacc1e8206b2f0cb0603ea415389d3 Mon Sep 17 00:00:00 2001 From: "Khan, Arshad" Date: Thu, 8 Oct 2020 16:59:20 +0530 Subject: [PATCH] presentedViewController must be used on main thread only --- .../PresentationHandling/MVMCoreNavigationHandler.m | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationHandler.m b/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationHandler.m index 5849d9f..4a31a6c 100644 --- a/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationHandler.m +++ b/MVMCore/MVMCore/PresentationHandling/MVMCoreNavigationHandler.m @@ -117,11 +117,14 @@ } - (void)removeCurrentViewController { - if (self.viewControllerToPresentOn.presentedViewController) { - [[MVMCoreNavigationHandler sharedNavigationHandler] dismissTopViewControllerAnimated:YES]; - } else { - [[MVMCoreNavigationHandler sharedNavigationHandler] popTopViewControllerAnimated:YES]; - } + [MVMCoreDispatchUtility performBlockOnMainThread:^{ + // presentedViewController must be used on main thread + if (self.viewControllerToPresentOn.presentedViewController) { + [[MVMCoreNavigationHandler sharedNavigationHandler] dismissTopViewControllerAnimated:YES]; + } else { + [[MVMCoreNavigationHandler sharedNavigationHandler] popTopViewControllerAnimated:YES]; + } + }]; } #pragma mark - Navigation Simple