环信

环信EaseUI

  1. 导入环信SDK和EaseUI
    使用cocoapods集成
pod "Hyphenate"
pod 'EaseUI', :git => 'https://github.com/easemob/easeui-ios-cocoapods.git'

集成视频:http://www.imgeek.org/video/

  1. 初始化环信
    EMOptions *option = [EMOptions optionsWithAppkey:@"1180180615177830#test"];
    EMError *error = [[EMClient sharedClient] initializeSDKWithOptions:option];
    if (!error) {
        NSLog(@"初始化成功");
    }
  1. 登录环信
EMError *error = [[EMClient sharedClient] loginWithUsername:@"1013633835175120896" password:@"123456"];
    if (!error) {
        NSLog(@"登录成功");
    }else {
        NSLog(@"登录失败%u", error.code);
    }
  1. 使用EaseUI聊天界面
  • 创建一个类继承EaseMessageViewController,我这里是创建了ChatViewController。执行一下代码加入聊天绘画
/*
    EMConversationTypeChat  = 0,    单聊会话 
    EMConversationTypeGroupChat,    群聊会话    
    EMConversationTypeChatRoom      聊天室会话
*/

ChatViewController *chat = [[ChatViewController alloc] initWithConversationChatter:@"52588264357889"  
 conversationType:EMConversationTypeGroupChat];
  • 获取群聊会话标题
[[EMClient sharedClient].groupManager getGroupSpecificationFromServerWithId:self.groupID completion:^(EMGroup *aGroup, EMError *aError) {
    NSString *s = [aGroup.subject stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    self.title = s;
 }];

你可能感兴趣的:(环信)