From f1688e7e9e8d79b8ee8ed9d36dbf3093ac786d97 Mon Sep 17 00:00:00 2001 From: Blake Knight <bknight@gsandf.com> Date: Thu, 11 Jan 2018 10:38:37 -0600 Subject: [PATCH] :bug: open safariViewController from main thread implement fix from fullstackreact/react-native-oauth#150 --- ios/OAuthManager/OAuthManager.m | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ios/OAuthManager/OAuthManager.m b/ios/OAuthManager/OAuthManager.m index 405d4be..e8c93ab 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) { + 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]; }