在使用环信的过程,用pods导入环信SDK是没问题的, pods语句如下(静态库不包含语音版SDK):
pod 'HyphenateLite_CN', :git => 'https://github.com/easemob/hyphenate-cocoapods.git', :tag => '3.2.2.2'
pod 'EaseUI', :git => 'https://github.com/easemob/easeui-ios-hyphenate-cocoapods.git', :tag => '3.2.2'
但在使用手动导入SDK的过程中,简直是一堆报错。。接下来就仔细说说这些乱七八糟的坑。
一、导入HyphenateSDK
1、下图是从环信官网上下载的demo+SDK的zip,由于项目要求有实时语音的要求,所以导入了HyphenateFullSDK,如图1-1、1-2所示。


2、这是导入之后的截图,如图1-3

3、不要立刻运行,按照官网的说明,在General->Linked Frameworks and Libraries中添加相应的依赖库,如图1-4

4、接下来在BuildSettings中搜索Prefix Header 并修改成YES,如图1-5所示

5、这个时候运行会显示Build Succeed,But、在模拟器还没出现的时候会crash,如图1-6所示

6、reason显示image not found,你以为是缺少了image类库等,然而并不是!重点来了,在各种搜索对比官方demo之后发现了,在General->Embedded Binaries中官网的demo是有HyPhenate.framework的,自己的项目并没有,如图1-7所示,在自己的项目中添加这个依赖库后再运行,就OK啦,完美运行!

二、导入EaseUI
1、按照图1-1的步骤把EaseUI拖进工程,拖完的工程的运行时会报错(我的是17个错误),如图2-1所示,主要原因是没有导入相关的头文件。

2、创建pch文件(网上有千百种方法,在这里不做描述),并导入头文件再运行就OK啦,
值得注意的是,在pch导入头文件时在首位部一定要加上#ifdef __OBJC__和#endif,如图2-2

附:
环信v3.x版本SDK下载链接:http://www.easemob.com/download/im
第一次写文本,有错误的地方多多包涵,希望能给使用环信的小伙伴们带来帮助!
网友评论