iOS 智能会话SDK 接入指南(v1.1.0)
Deploy target : iOS 8.0.
1 如何接入
1.1 在项目的 Podfile 中,添加如下依赖:
target 'YourProject' do
pod 'SHWChatRobotSDK', '~> 1.1.0'
end
1.2 更新安装
pod update
pod install
2 Regist your app.
Get your AppKey in our web site. appKey值可从新华智云接口人获取(网站建设中,目前请联系接口人)
3 How to use
3.1 设置AppKey和AppSecret
//选择是否使用测试环境。默认为NO,使用正式环境。
[SHWCRPublicConfig setIsTestEnvironment:YES];
[SHWCRPublicConfig setSWAppKey:@"Your_APPKEY" secretKey:@"Your_APPSECRET"];
3.2 提问接口
@interface SHWCRQuestionService : NSObject
/**
* @brief 聊天中的发送问句接口
*
* @param question 用户问句
* @param completionHandler 包含服务器返回结果result的回调block
*/
+ (void)askQuestion:(NSString *)question callback:(void (^)(NSDictionary *result, NSString *clientErrMsg, NSInteger clientCode))completionHandler;
4 其它
项目使用了巴吉度,请参考接入文档
项目使用了http协议,所以需要适配
- 在
Info.plist
中添加NSAppTransportSecurity
类型Dictionary
。 - 在
NSAppTransportSecurity
下添加NSAllowsArbitraryLoads
类型Boolean
,值设为YES
。 - 将
Build setting
下Build Options
中的Enable Bitcode
置为NO
。
5 错误码
错误码 | 错误类型 |
---|---|
200 | 无错误 |
500 | 服务器错误 |
900 | 解析错误 |
901 | 没有有效数据 |
1000 | 未知错误 |
1011 | 网络错误 |
6 Change Log
v1.0.7
- 更新依赖的巴吉度版本
v1.0.8
- 更新测试环境接口地址
v1.1.0
- fix 动态库编译失败问题