LinkedIn API在iOS上遇到问题

时间:2014-09-24 05:24:44

标签: ios linkedin

我使用以下链接

将LinkedIn API集成到我的应用中

https://github.com/jeyben/IOSLinkedInAPI

当我将api集成到我的应用程序中时,第一次登录时非常好。之后,由于下面的错误

,从LinkedIn API类开始以及从未打开Linkedin登录视图的问题如下
- (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];

}

问题在

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

错误是

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

非常奇怪,我查了一些论坛运行viewDidAppear建议的代码,但在我的情况下,我无法在viewDidAppear中运行它,因为它不是我的自定义类。可以请任何人建议我如何避免这个问题?由于这个问题,当我点击LinkedIn登录按钮时,Loginview没有出现,我正在使用XCode6。在此先感谢!

1 个答案:

答案 0 :(得分:2)

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

其中说你试图通过presentViewController展示你的nc。但问题是你的presentingViewcontroller不在视图层次结构中(即presentingViewcontroller中的实例既没有呈现也没有推送(根本不在视图中))