美文网首页
环信-即时通讯3.x

环信-即时通讯3.x

作者: iOS_我更专业 | 来源:发表于2017-05-19 16:43 被阅读0次

环信文档写的基本可以,但我在Pods时,却遇到问题,我Pod的是:

Pod

登录、注册、简单聊天都不再细说。主要说下好友列表+添加朋友+以及朋友收到的请求处理:

一、好友列表

我在Appdelegate中添加:

[[NSNotificationCenterdefaultCenter]postNotificationName:@"messCount"object:niluserInfo:@{@"allMes":aMessages}];

记得清除:[[NSNotificationCenterdefaultCenter]removeObserver:selfname:@"messCount"object:nil];

记得在ViewController上增加:

[[NSNotificationCenterdefaultCenter]addObserver:selfselector:@selector(badgeCount:)name:@"messCount"object:nil];

这里可以监听到信息,以及未读信息。当然在这个页面里也增加读取用户朋友列表。

二、登录、注册等

这一块官方文档写的比较完善,加载即可使用。

三、添加朋友

[[EMClient sharedClient].contactManager addContact:@“好友名字” message:@"我想加您为好友"];

当然,这里主要说下,被加人的监听方法,在appdelegate里写:

[[EMClient sharedClient].contactManager addDelegate:self delegateQueue:nil];

- (void)friendRequestDidReceiveFromUser:(NSString *)aUsername

message:(NSString *)aMessage;在这里即可进行

四、聊天

EaseMessageViewController *chatController = [[EaseMessageViewController alloc] initWithConversationChatter:@"***" conversationType:EMConversationTypeChat];

chatController.hidesBottomBarWhenPushed = YES;

[self.navigationController pushViewController:chatController animated:YES];

简单粗暴。写的不好,有什么问题可以直接留言细说。

相关文章

网友评论

      本文标题:环信-即时通讯3.x

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