美文网首页
iOS集成环信SDK点击聊天图片无效问题

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

作者: Gary_Kwok | 来源:发表于2017-01-06 23:50 被阅读0次

    通过[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];
    

    问题解决。

    相关文章

      网友评论

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

          本文链接:https://www.haomeiwen.com/subject/htgxbttx.html