即时通讯-环信
准备
1.下载SDK http://www.easemob.com/download
2.证书下载上传
后期发送消息 需要推送发送的内容
http://docs.easemob.com/doku.php?id=im:300iosclientintegration:10prepareforsdkimport
3.导入SDK
4.导入依赖库
CoreMedia.framework
AudioToolbox.framework
AVFoundation.framework
MobileCoreServices.framework
ImageIO.framework
SystemConfiguration.framework
libc++.dylib
libresolv.dylib
libz.dylib
libstdc++.6.0.9.dylib
libsqlite3.dylib
5.添加-force_load
targets->build setting->other linker flags->添加-force_load->静态库拖动到他的下面
6.SDK不支持bitcode ->build setting 中设置为NO
使用
1.注册环信
(1)导入头文件#import "EMSDK.h"
(2)注册代码
EMOptions *options = [EMOptions optionsWithAppkey:@"xuanyi#im"];
options.apnsCertName = @"DDD";
[[EMClient sharedClient] initializeSDKWithOptions:options];
(3)用户注册
EMError *error = [[EMClient sharedClient] registerWithUsername:@"ming" password:@"111"];
(4)用户登录
EMError *error = [[EMClient sharedClient] loginWithUsername:@"ming" password:@"111"];
(5)添加好友
《1》EMError *error = [[EMClient sharedClient].contactManager addContact:@"xiao" message:@"..."];
《2》[[EMClient sharedClient].contactManager addDelegate:self delegateQueue:nil];
《3》成功didReceiveAgreedFromUsername:
《4》遭拒绝didReceiveDeclinedFromUsername:
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)