iOS集成环信SDK点击聊天图片无效问题

2017-01-06  本文已影响0人  Gary_Kwok

通过[self.navigationController pushViewController:viewController animated:YES]; 这种方法跳到环信聊天界面时,则一切正常。

但是如果通过[self presentViewController:chatVc animated:YES completion:nil];这种方法跳到环信聊天界面时,点击聊天图片会无效,控制台提示:

2017-01-06 23:40:20.711 GreenPZ[1788:689882] Warning: Attempt to present <UINavigationController: 0x164a7c00> on <GTabbarViewController: 0x16331200> whose view is not in the window hierarchy!

解决方法:
在 EaseUI的 EaseMessageReadManager.m的-(void)showBrowserWithImages::(NSArray *)imageArray方法里

最后两句话

UIViewController *rootController = [self.keyWindow rootViewController];
[rootController presentViewController:self.photoNavigationController animated:YES completion:nil];

由于在设置根视图时, 将自定义的GTabbarViewController作为了rootViewController,所以系统找不到根视图了

修改为:

UIViewController *vc = [[UIViewController alloc] init];
vc.view.hidden = YES; // 在回来之后上面会覆盖一层view所以要设为hidden, 否则界面无法操作
[self.keyWindow addSubview:vc.view];
[vc presentViewController:self.photoNavigationController animated:YES completion:nil];

问题解决。

上一篇下一篇

猜你喜欢

热点阅读