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]; }