diff --git a/IOSLinkedInAPI/LIALinkedInHttpClient.m b/IOSLinkedInAPI/LIALinkedInHttpClient.m index e7ed9dc..95e0e78 100755 --- a/IOSLinkedInAPI/LIALinkedInHttpClient.m +++ b/IOSLinkedInAPI/LIALinkedInHttpClient.m @@ -133,16 +133,22 @@ - (void)getAuthorizationCode:(void (^)(NSString *))success cancel:(void (^)(void } - (void)showAuthorizationView:(LIALinkedInAuthorizationViewController *)authorizationViewController { - if (self.presentingViewController == nil) - self.presentingViewController = [[UIApplication sharedApplication] keyWindow].rootViewController; - - UINavigationController *nc = [[UINavigationController alloc] initWithRootViewController:authorizationViewController]; - - if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) { - nc.modalPresentationStyle = UIModalPresentationFormSheet; - } - - [self.presentingViewController presentViewController:nc animated:YES completion:nil]; + if (self.presentingViewController == nil) { + UIViewController *rootVC = [[UIApplication sharedApplication] keyWindow].rootViewController; + if (rootVC.presentedViewController == nil) { + self.presentingViewController = rootVC; + } else { + self.presentingViewController = rootVC.presentedViewController; + } + } + + UINavigationController *nc = [[UINavigationController alloc] initWithRootViewController:authorizationViewController]; + + if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) { + nc.modalPresentationStyle = UIModalPresentationFormSheet; + } + + [self.presentingViewController presentViewController:nc animated:YES completion:nil]; } - (void)hideAuthenticateView {