简体   繁体   中英

LinkedIn API getting issue for iOS

I integrated LinkedIn API into my app using following link

https://github.com/jeyben/IOSLinkedInAPI

First time its loggedin with pretty good when i was integrated that api into my app. After that onwards getting issue as below from LinkedIn API class and its never opening Linkedin loginview due to error of below

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

}

issue is in

   [self.presentingViewController presentViewController:nc animated:YES completion:nil];

the error is

Warning: Attempt to present <UINavigationController: 0x787db610> on <myViewController: 0x78677de0> whose view is not in the window hierarchy!**

Its very strange, I checked some forums run code in viewDidAppear suggested, but in my case I could not run this in viewDidAppear because its not my custom class. Could please anyone suggest me how to avoid this issue? Due to this issue, while I am clicking the LinkedIn login button the Loginview not appearing and I am using XCode6 . Thanks in Advance!

   [self.presentingViewController presentViewController:nc animated:YES completion:nil];

Which says you are trying to present your nc from presentingViewController. But problem here is your presentingViewcontroller is not in view hierarchy(ie the instance that is there in the presentingViewcontroller is neither presented nor pushed (Not in view at all))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM