注册环信账号
打开环信官方网站地址,注册选择即时通讯云,然后注册个人客户。
注册个人客户.png
提交后,打开邮箱验证环信注册,验证成功后即注册成功。
注册成功.png
创建应用
注册成功,登录环信即时通讯云。
登录环信即时通讯云.png
点击创建应用创建应用。
创建应用.png
配置应用信息。
配置应用信息.png
得到我们创建的应用。
我们创建的应用.png
导入环信SDK
创建工程,命名为iOS_Obj_NPWeiChat。
创建工程.png
配置应用AppKey,在工程的AppDelegate.m文件中添加应用的AppKey。
#define KEYNPWEICHAR @"nieplus#npweichat"
配置appkey.png
使用CocoaPods导入SDK,打开终端,执行命令,
➜ ~ git:(master) ✗ cd iOS_Obj_NPWeiChat
➜ iOS_Obj_NPWeiChat git:(master) ✗ ls
iOS_Obj_NPWeiChat iOS_Obj_NPWeiChat.xcodeproj
➜ iOS_Obj_NPWeiChat git:(master) ✗ touch Podfile
➜ iOS_Obj_NPWeiChat git:(master) ✗ vim Podfile
添加导入HyphenateFullSDK,编辑Podfile文件,
source 'https://github.com/CocoaPods/Specs.git'
inhibit_all_warnings!
target "iOS_Obj_NPWeiChat" do
pod 'HyphenateFullSDK', '~> 3.1.3'
end
ESC:->wq保存退出,执行pod install导入环信SDK,网速不好会加载一段时间,
➜ iOS_Obj_NPWeiChat git:(master) ✗ pod install
Analyzing dependencies
Downloading dependencies
Installing HyphenateFullSDK (3.1.3)
加载到如下显示,即导入成功,
➜ iOS_Obj_NPWeiChat git:(master) ✗ pod install
Analyzing dependencies
Pre-downloading: `HyphenateFullSDK` from `https://github.com/easemob/hyphenate-full-cocoapods.git`
Downloading dependencies
Installing HyphenateFullSDK (3.1.4)
Generating Pods project
Integrating client project
[!] Please close any current Xcode sessions and use `iOS_Obj_NPWeiChat.xcworkspace` for this project from now on.
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 1 total
pod installed.
➜ iOS_Obj_NPWeiChat git:(master) ✗
关闭iOS_Obj_NPWeiChatiOS.xcodeproj工程,打开iOS_Obj_NPWeiChat.xcworkspace工程
➜ iOS_Obj_NPWeiChat git:(master) ✗ open iOS_Obj_NPWeiChat.xcworkspace/
编译工程,如果没有报错,即导入成功。