From 786873ac2bfe4976fa5823150ea9d2e121407c49 Mon Sep 17 00:00:00 2001 From: Tom Clarkson Date: Mon, 28 Aug 2017 18:11:51 +1000 Subject: [PATCH] Open safariViewController from main thread --- ios/OAuthManager/OAuthManager.m | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ios/OAuthManager/OAuthManager.m b/ios/OAuthManager/OAuthManager.m index a9451bc..f490ecf 100644 --- a/ios/OAuthManager/OAuthManager.m +++ b/ios/OAuthManager/OAuthManager.m @@ -88,9 +88,11 @@ + (BOOL)setupOAuthHandler:(UIApplication *)application [authPlatform setURLOpener: ^void(NSURL *URL, DCTAuthPlatformCompletion completion) { // [sharedManager setPendingAuthentication:YES]; if ([SFSafariViewController class] != nil) { - safariViewController = [[SFSafariViewController alloc] initWithURL:URL]; - UIViewController *viewController = application.keyWindow.rootViewController; - [viewController presentViewController:safariViewController animated:YES completion: nil]; + dispatch_async(dispatch_get_main_queue(), ^{ + safariViewController = [[SFSafariViewController alloc] initWithURL:URL]; + UIViewController *viewController = application.keyWindow.rootViewController; + [viewController presentViewController:safariViewController animated:YES completion: nil]; + }); } else { [application openURL:URL]; }