Latest 1.0.1
Homepage https://github.com/newsdata/shuwen-chatrobot-no-ui-sdk
License MIT
Platforms ios 8.0, requires ARC
Dependencies UTDID
Frameworks CoreLocation, SystemConfiguration, CoreFoundation, Security
Authors

iOS聊天机器人SDK 接入指南(v1.0.1)

Deploy target : iOS 8.0.

1 如何接入

1.1 在项目的 Podfile 中,添加如下依赖:

target 'YourProject' do
pod 'SHWChatRobotSDK', '~> 1.0.1'
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

[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 (^)(NSArray <NSDictionary*>*result, NSString *clientErrMsg, NSInteger clientCode))completionHandler;

4 其它

项目使用了http协议,所以需要适配

  • Info.plist中添加NSAppTransportSecurity类型Dictionary
  • NSAppTransportSecurity下添加NSAllowsArbitraryLoads类型Boolean,值设为YES
  • Build settingBuild Options 中的Enable Bitcode 置为 NO

5 错误码

错误码 错误类型
200 无错误
500 服务器错误
900 解析错误
901 没有有效数据
1000 未知错误
1011 网络错误

Latest podspec

{
    "name": "SHWChatRobotNOUI",
    "version": "1.0.1",
    "summary": "iOSu804au5929u673au5668u4ebau65e0UI SDK",
    "homepage": "https://github.com/newsdata/shuwen-chatrobot-no-ui-sdk",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "yangyang": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/newsdata/shuwen-chatrobot-no-ui-sdk.git",
        "tag": "1.0.1"
    },
    "vendored_frameworks": "SHWChatRobotNOUI/Classes/SHWChatRobWithoutUI.framework",
    "requires_arc": true,
    "frameworks": [
        "CoreLocation",
        "SystemConfiguration",
        "CoreFoundation",
        "Security"
    ],
    "dependencies": {
        "UTDID": [
            "~> 1.0.0"
        ]
    }
}

Pin It on Pinterest

Share This