1 Star 0 Fork 0

Z7Game / AIHelp-iOS-SDK

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
Apache-2.0

英文版接入文档

IOS SDK 接入说明

  1. SDK支持iOS8及以上iOS版本。
  2. 甲方有义务按照乙方接入文档说明的正常接入方式和调用方式使用乙方服务,如甲方通过技术手段影响乙方计费,乙方有权在通知甲方的同时立即单方面终止服务,并要求甲方承担责任。

一、下载iOS SDK

  1. 点击这里右上角的“Clone or download”按钮下载IOS SDK,下载完成后解压文件。

二、导入ElvaChatServiceSDK

  1. 导入文件夹 ElvaChatServiceSDK 到项目工程中

三、接入工程配置

  1. 必须在 Xcode Build Settings 里面 Other Linker Flags 设置值 -ObjC
    该项如果设置错误,运行时就会出现异常:unrecognized selector sent to instance exception

  2. 添加依赖库,在项目设置target -> 选项卡General ->Linked Frameworks and Libraries添加如下依赖库:
    libsqlite3.tbd libresolv.tbd WebKit.framework

  3. 设置SDK所需权限, 在项目工程的 info.plist 中增加4个权限:
    Privacy - Photo Library Usage Description 需要访问您的相册权限,才能将图片上传反馈给客服
    Privacy - Camera Usage Description 需要访问您的相机权限,才能拍摄问题图片并反馈给客服
    Privacy - Photo Library Additions Usage Description 需要照片添加权限,才能保存图片到相册
    Privacy - Microphone Usage Description需要访问您的麦克风权限,才能在表单页上传视频录像并反馈给客服 也可以一项一项的在Xcode里面添加权限,也可以直接用文本编辑器打开 info.plist 添加如下内容:

<key>NSCameraUsageDescription</key>  
<string>需要访问您的相机权限,才能拍摄问题图片并反馈给客服</string>  
<key>NSPhotoLibraryAddUsageDescription</key>  
<string>需要照片添加权限,才能保存图片到相册</string>  
<key>NSPhotoLibraryUsageDescription</key>  
<string>需要访问您的相册权限,才能将图片上传反馈给客服</string>
<key>NSMicrophoneUsageDescription</key>
<string>需要访问您的麦克风权限,才能在表单页上传视频录像并反馈给客服</string>

四、SDK初始化(必须在应用启动阶段调用)

甲方有义务按照乙方接入文档说明的正常接入方式和调用方式使用乙方服务,如甲方通过技术手段影响乙方计费,乙方有权在通知甲方的同时立即单方面终止服务,并要求甲方承担责任。

  1. 引入相关头文件 #import <ElvaChatServiceSDK/ElvaChatServiceSDK.h>
  2. 在工程的 AppDelegate 中的application:didFinishLaunchingWithOptions方法中,调用 SDK 初始化方法。
[ECServiceSdk init:app_key Domain:app_domain AppId:app_id];

参数说明:

参数 说明
app_key app密钥,可以从Web管理系统获取 APP Key
app_domain app域名,可以从Web管理系统获取 Domain
app_id app唯一标识,可以从Web管理系统获取 Platforms(AppID)

注:上面这三个参数,请使用注册时的邮箱地址作为登录名登录 AIHelp 客服后台
在Settings菜单Applications页面查看。
初次使用,请先登录AIHelp 官网自助注册。

初始化代码示例:(必须在应用启动阶段调用)
甲方有义务按照乙方接入文档说明的正常接入方式和调用方式使用乙方服务, 如甲方通过技术手段影响乙方计费,乙方有权在通知甲方的同时立即单方面终止服务,并要求甲方承担责任。

[ECServiceSdk init:@"YOUR_APP_KEY" Domain:@"YOUR_DOMAIN_NAME" AppId:@"YOUR_APP_ID"];

开始使用SDK

1.界面说明

可选接口 接口作用 备注
showElva 启动机器人客服界面
showConversation 启动人工客服界面 需先调用setUserName
showElvaOP 启动运营界面
showFAQs 展示全部FAQ菜单 需配置FAQ,需先调用setUserNamesetUserId
showFAQSection 展示FAQ分类 需配置FAQ,需先调用setUserNamesetUserId
showSingleFAQ 展示单条FAQ 需配置FAQ,需先调用setUserNamesetUserId
setSDKLanguage 设置SDK语言 默认使用手机系统语言设置,设置后可以调用应用内设置语言
setSDKInterfaceOrientationMask 设置SDK显示方向 需要设备显示对应方向的权限
建议接口 接口作用 备注
setName 设置游戏名称 设置后在SDK导航栏会显示游戏的名称
setUserId 设置用户ID 如果游客用户拿不到userId,请传入空字符串@"",SDK会生成唯一设备id来区分不同的用户
setUserName 设置用户名称 如果拿不到userName,传入空字符串@"",会使用默认昵称"anonymous"

注:您并不需要调用以上所有接口,尤其当您的游戏/应用只设置一个客服入口时,有的接口所展示的界面包含了其他接口,具体API细节见下方描述

2.智能客服主界面启动,调用 showElva 方法,启动机器人界面

[ECServiceSdk showElva:playerName
             PlayerUid:playerUid
              ServerId:serverId
         PlayerParseId:playerParseId
PlayershowConversationFlag:showConversationFlag];

[ECServiceSdk showElva:playerName
             PlayerUid:playerUid
              ServerId:serverId
         PlayerParseId:playerParseId
PlayershowConversationFlag:showConversationFlag
                Config:config];

代码示例:

//您需要将相同的标签添加到“AIHELP Web控制台”才能生效。
NSMutableArray * tags = [NSMutableArray array]; //定义tag容器
[tags addObject:@"vip"];
[tags addObject:@"pay1"];

NSMutableDictionary *customData = [NSMutableDictionary dictionary];//定义自定义参数容器
[customData setObject:tags forKey:@"elva-tags"]; //添加Tag值标签
[customData setObject:@"1.0.0" forKey:@"VersionCode"];  //添加自定义的参数

NSMutableDictionary *config = [NSMutableDictionary dictionary]; //定义config参数容器
[config setObject:customData forKey:@"elva-custom-metadata"]; //将customData存入容器

[ECServiceSdk showElva:@"USER_NAME"
             PlayerUid:@"USER_ID"
              ServerId:@"123"
         PlayerParseId:@""
PlayershowConversationFlag:@"1"
                Config:config];

/* config 示例内容:
    {
        "elva-custom-metadata": {
            "elva-tags": [
                "vip",
                "pay1"
            ],
            "VersionCode": "1.0.0"       
        }
}
*/

参数说明:

参数 说明
playerName 游戏中用户名称。如果拿不到userName,传入空字符串@"",会使用默认昵称"anonymous"
playerUid 用户在游戏里的唯一标示id。如果拿不到uid,传入空字符串@"",系统会生成一个唯一设备id
serverId 用户所在的服务器编号。
playerParseId 传空字符串。
showConversationFlag 参数的值是 “0” 或 “1”,标识是否开启人工入口。为 “1” 时,将在机器人客服聊天界面右上角,提供人工客服聊天的入口。如下图。。
config 可选参数,自定义Dictionary信息。可以在此处设置特定的Tag信息。
说明:elva-tags对应的值为array类型,此处传入自定义的标签,需要在AIHelp 客服后台配置同名称的标签才能生效。
showElva

最佳实践:

  1. 在您应用的客服主入口触发这个接口的调用。在AIHelp 客服后台配置个性化的机器人欢迎语,以及更多机器人对话故事线,引导用户反馈并得到回答。
  2. 打开人工客服入口,用户可以在机器人客服界面右上角进入人工客服进行聊天, 你也可以设置条件只让一部分用户看到这个入口。

3.直接进行人工客服聊天,调用 showConversation 方法(必须确保设置用户名称信息 setUserName 已经调用)

[ECServiceSdk showConversation:playerUid ServerId:serverId];

[ECServiceSdk showConversation:playerUid ServerId:serverId Config:config];

代码示例:

[ECServiceSdk setUserName:@"PLAYER_NAME"];  //需要先调用此方法

//您需要将相同的标签添加到“AIHELP Web控制台”才能生效。
NSMutableArray * tags = [NSMutableArray array]; //定义tag容器
[tags addObject:@"vip"];
[tags addObject:@"pay1"];

NSMutableDictionary *customData = [NSMutableDictionary dictionary];//定义自定义参数容器
[customData setObject:tags forKey:@"elva-tags"]; //添加Tag值标签
[customData setObject:@"1.0.0" forKey:@"VersionCode"];  //添加自定义的参数

NSMutableDictionary *config = [NSMutableDictionary dictionary]; //定义config参数容器
[config setObject:customData forKey:@"elva-custom-metadata"]; //将customData存入容器

[ECServiceSdk showConversation:@"PLAYER_ID" ServerId:@"123" Config:config];

参数说明:

参数 说明
playerUid 用户在游戏里的唯一标示id。如果拿不到uid,传入空字符串@"",系统会生成一个唯一设备id
serverId 用户所在的服务器编号。
config 可选参数,自定义Dictionary信息。可以在此处设置特定的Tag信息。
说明:elva-tags对应的值为array类型,此处传入自定义的标签,需要在AIHelp 客服后台配置同名称的标签才能生效。

最佳实践:

通常你不需要调用这个接口,除非你想在应用里设置触发点,让用户有机会直接进入人工客服聊天界面。

showConversation

4.运营主界面启动,调用 showElvaOP 方法

当您想向用户展示应用程序/游戏的更新、新闻、文章或任何背景信息时,操作模块非常有用。

[ECServiceSdk showElvaOP:playerName 
               PlayerUid:playerUid 
                ServerId:serverId 
           PlayerParseId:playerParseId 
PlayershowConversationFlag:showConversationFlag 
                  Config:config];

[ECServiceSdk showElvaOP:playerName 
               PlayerUid:playerUid 
                ServerId:serverId 
           PlayerParseId:playerParseId 
PlayershowConversationFlag:showConversationFlag 
                  Config:config
         defaultTabIndex:defaultTabIndex];

代码示例:

//您需要将相同的标签添加到“AIHELP Web控制台”才能生效。
NSMutableArray * tags = [NSMutableArray array]; //定义tag容器
[tags addObject:@"vip"];
[tags addObject:@"pay1"];

NSMutableDictionary *customData = [NSMutableDictionary dictionary];//定义自定义参数容器
[customData setObject:tags forKey:@"elva-tags"]; //添加Tag值标签
[customData setObject:@"1.0.0" forKey:@"VersionCode"];  //添加自定义的参数

NSMutableDictionary *config = [NSMutableDictionary dictionary]; //定义config参数容器
[config setObject:customData forKey:@"elva-custom-metadata"]; //将customData存入容器

[ECServiceSdk showElvaOP:@"USER_NAME" 
               PlayerUid:@"USER_ID" 
                ServerId:@"123" 
           PlayerParseId:@"" 
PlayershowConversationFlag:@"1" 
                  Config:config];

参数说明:

参数 说明
playerName 游戏中用户名称。如果拿不到uname,传入空字符串@"",会使用默认昵称"anonymous"
playerUid 用户在游戏里的唯一标示id。如果拿不到uid,传入空字符串@"",系统会生成一个唯一设备id
serverId 用户所在的服务器编号。
playerParseId 传空字符串。如:@""
showConversationFlag 参数的值是 “0” 或 “1”,标识是否开启人工入口。为 “1” 时,将在机器人客服聊天界面右上角,提供人工客服聊天的入口。如下图。
config 可选参数,自定义Dictionary信息。可以在此处设置特定的Tag信息。
说明:elva-tags对应的值为array类型,此处传入自定义的标签,需要在AIHelp 客服后台配置同名称的标签才能生效。
defaultTabIndex 可选,进入运营界面时候展示的tab的编号。默认是0,也就是默认为第一个tab,若需默认展示客服界面tab,设置值为999。
showElvaOP

最佳实践:

  1. 在您应用的运营入口触发这个接口的调用。 在AIHelp 客服后台配置运营分页(tab)并且发布跟应用相关的运营公告内容。就通过AIHelp展示这些内容给用户。运营界面的最后一个分页总是机器人客服聊天界面。
  2. 在tab页面,用户可以在页面右上角进入FAQ页面查看;在机器人客服页面(Help页面),用户可以在页面右上角进入人工客服,此人工客服入口可以通过参数设置条件,根据条件打开或关闭,只让一部分用户看到这个入口。

5.展示FAQ列表,调用 showFAQs 方法(必须确保设置用户名称信息 setUserName 和设置用户唯一id信息 setUserId 已经调用)

[ECServiceSdk showFAQs];

[ECServiceSdk showFAQs:config];

代码示例:

[ECServiceSdk setUserName:@"PLAYER_NAME"];  //需要调用此方法
[ECServiceSdk setUserId:@"123ABC567DEF"];   //需要调用此方法

//您需要将相同的标签添加到“AIHELP Web控制台”才能生效。
NSMutableArray * tags = [NSMutableArray array]; //定义tag容器
[tags addObject:@"vip"];
[tags addObject:@"pay1"];
NSMutableDictionary *customData = [NSMutableDictionary dictionary];//定义自定义参数容器
[customData setObject:tags forKey:@"elva-tags"]; //添加Tag值标签
[customData setObject:@"1.0.0" forKey:@"VersionCode"];  //添加自定义的参数
NSMutableDictionary *config = [NSMutableDictionary dictionary]; //定义config参数容器
[config setObject:customData forKey:@"elva-custom-metadata"]; //将customData存入容器

//一、联系我们按钮显示逻辑
//    0、默认:FAQ列表页和详情页不显示,点击“踩”,显示联系我们按钮。不用处理 config。
//    1、一直显示:需要设置'showContactButtonFlag',添加如下代码即可
//        [config setObject:@"1" forKey:@"showContactButtonFlag"];
//    2、永不显示:需要设置'hideContactButtonFlag',添加如下代码即可
//        [config setObject:@"1" forKey:@"hideContactButtonFlag"];

//二、点击联系我们按钮(经过一步骤,显示了联系我们按钮的前提)进入客服页面的逻辑
//    0、默认:进入机器人页面(无进行中客诉时,不显示人工客服按钮)。不用处理 config。
//    1、直接进入人工页面:需要设置'directConversation',添加如下代码即可
//        [config setObject:@"1" forKey:@"directConversation"];
//    2、进入机器人页面+人工客服入口按钮:需要设置'showConversationFlag',添加如下代码即可
//        [config setObject:@"1" forKey:@"showConversationFlag"];

[ECServiceSdk showFAQs:config];

参数说明:

参数 说明
config 可选,自定义Dictionary信息。可以在此处设置特定的Tag信息和是否提供人工或机器人聊天的入口功能
showFAQs

最佳实践:

在您应用的FAQ主入口触发这个接口的调用。在AIHelp 客服后台页面配置并分类FAQ,如果您的FAQ较多,可以增加一个父级分类。

6.展示相关部分FAQ,调用 showFAQSection 方法(必须确保设置用户名称信息 setUserName 和设置用户唯一id信息 setUserId 已经调用)

[ECServiceSdk showFAQSection:sectionPublishId];

[ECServiceSdk showFAQSection:sectionPublishId Config:config];

代码示例:

[ECServiceSdk setUserName:@"PLAYER_NAME"];  //需要调用此方法
[ECServiceSdk setUserId:@"123ABC567DEF"];   //需要调用此方法

//您需要将相同的标签添加到“AIHELP Web控制台”才能生效。
NSMutableArray * tags = [NSMutableArray array]; //定义tag容器
[tags addObject:@"vip"];
[tags addObject:@"pay1"];
NSMutableDictionary *customData = [NSMutableDictionary dictionary];//定义自定义参数容器
[customData setObject:tags forKey:@"elva-tags"]; //添加Tag值标签
[customData setObject:@"1.0.0" forKey:@"VersionCode"];  //添加自定义的参数
NSMutableDictionary *config = [NSMutableDictionary dictionary]; //定义config参数容器
[config setObject:customData forKey:@"elva-custom-metadata"]; //将customData存入容器

//一、联系我们按钮显示逻辑
//    0、默认:FAQ列表页和详情页不显示,点击“踩”,显示联系我们按钮。不用处理 config。
//    1、一直显示:需要设置'showContactButtonFlag',添加如下代码即可
//        [config setObject:@"1" forKey:@"showContactButtonFlag"];
//    2、永不显示:需要设置'hideContactButtonFlag',添加如下代码即可
//        [config setObject:@"1" forKey:@"hideContactButtonFlag"];

//二、点击联系我们按钮(经过一步骤,显示了联系我们按钮的前提)进入客服页面的逻辑
//    0、默认:进入机器人页面(无进行中客诉时,不显示人工客服按钮)。不用处理 config。
//    1、直接进入人工页面:需要设置'directConversation',添加如下代码即可
//        [config setObject:@"1" forKey:@"directConversation"];
//    2、进入机器人页面+人工客服入口按钮:需要设置'showConversationFlag',添加如下代码即可
//        [config setObject:@"1" forKey:@"showConversationFlag"];

[ECServiceSdk showFAQSection:@"100" Config:config];

参数说明:

参数 说明
sectionPublishId FAQ Section的PublishID(可以在AIHelp 客服后台 中,从FAQs菜单下[Section]菜单,查看PublishID)。
config 可选,自定义Dictionary信息。可以在此处设置特定的Tag信息和是否提供人工或机器人聊天的入口功能
showFAQSection

7.展示单条FAQ,调用 showSingleFAQ 方法(必须确保设置用户名称信息 setUserName 和设置用户唯一id信息 setUserId 已经调用)

[ECServiceSdk showSingleFAQ:faqId];

[ECServiceSdk showSingleFAQ:faqId Config:config];

代码示例:

[ECServiceSdk setUserName:@"PLAYER_NAME"];  //需要调用此方法
[ECServiceSdk setUserId:@"123ABC567DEF"];   //需要调用此方法

//您需要将相同的标签添加到“AIHELP Web控制台”才能生效。
NSMutableArray * tags = [NSMutableArray array]; //定义tag容器
[tags addObject:@"vip"];
[tags addObject:@"pay1"];
NSMutableDictionary *customData = [NSMutableDictionary dictionary];//定义自定义参数容器
[customData setObject:tags forKey:@"elva-tags"]; //添加Tag值标签
[customData setObject:@"1.0.0" forKey:@"VersionCode"];  //添加自定义的参数
NSMutableDictionary *config = [NSMutableDictionary dictionary]; //定义config参数容器
[config setObject:customData forKey:@"elva-custom-metadata"]; //将customData存入容器

//一、联系我们按钮显示逻辑
//    0、默认:FAQ列表页和详情页不显示,点击“踩”,显示联系我们按钮。不用处理 config。
//    1、一直显示:需要设置'showContactButtonFlag',添加如下代码即可
//        [config setObject:@"1" forKey:@"showContactButtonFlag"];
//    2、永不显示:需要设置'hideContactButtonFlag',添加如下代码即可
//        [config setObject:@"1" forKey:@"hideContactButtonFlag"];

//二、点击联系我们按钮(经过一步骤,显示了联系我们按钮的前提)进入客服页面的逻辑
//    0、默认:进入机器人页面(无进行中客诉时,不显示人工客服按钮)。不用处理 config。
//    1、直接进入人工页面:需要设置'directConversation',添加如下代码即可
//        [config setObject:@"1" forKey:@"directConversation"];
//    2、进入机器人页面+人工客服入口按钮:需要设置'showConversationFlag',添加如下代码即可
//        [config setObject:@"1" forKey:@"showConversationFlag"];

[ECServiceSdk showSingleFAQ:@"20" Config:config];

参数说明:

参数 说明
faqId FAQ的编号。打开AIHelp 客服后台中,在机器人→常见问题页面下找到指定FAQ的FAQ编号,注意:此FAQID不能填写客服后台未存在的FAQ编号。
config 可选,自定义Dictionary信息。可以在此处设置特定的Tag信息和是否提供人工或机器人聊天的入口功能

注:如果在AIHelp 客服后台配置了FAQ的SelfServiceInterface,并且SDK配置了相关参数,将在显示FAQ的同时,右上角提供功能菜单,可以对相关的自助服务进行调用。

showSingleFAQ

8.设置游戏名称信息,调用 setName 方法

[ECServiceSdk setName:game_name];

代码示例:

[ECServiceSdk setName:@"Your Game"];

参数说明:

参数 说明
game_name 游戏名称,设置后将显示在SDK中相关界面导航栏。

最佳实践:

在初始化后调用该接口设置游戏名称,将显示在AIHelp相关界面标题栏。

9.设置用户唯一id信息,调用 setUserId 方法(使用自助服务必须调用,参见展示单条FAQ)

[ECServiceSdk setUserId:playerUid];

代码示例:

[ECServiceSdk setUserId:@"123ABC567DEF"];

参数说明:

参数 说明
playerUid 用户唯一ID,如果拿不到uid,传入空字符串@"",系统会生成一个唯一设备id

最佳实践:

通常你可以用在其他接口传入用户Id,无需调用该接口,但是若要使用自助服务,则必须调用。

10.设置用户名称信息,调用 setUserName 方法()

[ECServiceSdk setUserName:playerName];

代码示例:

[ECServiceSdk setUserName:@"PLAYER_NAME"];

参数说明:

参数 说明
playerName 用户名称。如果拿不到uname,传入空字符串@"",会使用默认昵称"anonymous"

最佳实践:

  1. 传入你的App的用户名称,这样在后台客户服务页面会展示用户的应用内名称,便于客服在服务用户时个性化称呼对方。
  2. 通常你无需调用该接口,可以用其他接口传入用户名称,但是若要使用自助服务,则必须调用。

11.设置服务器编号信息,调用 setServerId 方法(使用自助服务必须调用,参见展示单条FAQ)

[ECServiceSdk setServerId:serverId];

代码示例:

[ECServiceSdk setServerId:@"SERVER_ID"];

参数说明:

参数 说明
serverId 服务器ID。

最佳实践:

通常你无需调用该接口,可以用其他接口传入服务器ID,但是若要使用自助服务,则必须调用。

12.设置SDK语言,调用 setSDKLanguage 方法

[ECServiceSdk setSDKLanguage:language];

代码示例:

[ECServiceSdk setSDKLanguage:@"en"];

参数说明:

参数 说明
language 语言名称代码。如英语为en,简体中文为zh_CN。更多语言简称参见AIHelp后台,"设置"-->"语言"的Alias列。
语言Alias列

最佳实践:

  1. 通常SDK会使用手机的默认语言设置,如果你的应用使用跟手机设置不一样的语言,那么你需要在AIHelp SDK初始化之后调用此接口修改默认语言。
  2. 如果你的应用允许用户更改语言,那么每次更改语言之后,也需要调用此接口重新设置SDK的语言。

13.设置机器人客服界面另一个欢迎语。

如果你设置了进入AI客服的不同入口,希望用户从不同的入口进入AI客服时显示不同的欢迎语,进入不同故事线,可以通过设置config参数来实现:

NSMutableDictionary *welcomeText = [NSMutableDictionary dictionary];
[welcomeText setObject:@"usersay" forKey:@"anotherWelcomeText"];

代码示例:

//您需要将相同的标签添加到“AIHELP Web控制台”才能生效。
NSMutableArray * tags = [NSMutableArray array]; //定义tag容器
[tags addObject:@"vip"];
[tags addObject:@"pay1"];

NSMutableDictionary *customData = [NSMutableDictionary dictionary];//定义自定义参数容器
[customData setObject:tags forKey:@"elva-tags"]; //添加Tag值标签
[customData setObject:@"1.0.0" forKey:@"VersionCode"];  //添加自定义的参数

// 注:anotherWelcomeText是key,不能改变。需要改变的是usersay,保持和故事线中配置的UserSay内容一样
[customData setObject:@"usersay" forKey:@"anotherWelcomeText"]; //添加自定义欢迎语

NSMutableDictionary *config = [NSMutableDictionary dictionary]; //定义config参数容器
[config setObject:customData forKey:@"elva-custom-metadata"]; //将customData存入容器
//如果是在智能客服主界面中    
[ECServiceSdk showElva:@"TEST_PLAYER_NAME"
             PlayerUid:@"TEST_UID_123"
              ServerId:@"TEST_SRV_ID_123"
         PlayerParseId:@""
PlayershowConversationFlag:@"1"
                Config:config];

//如果是在智能客服运营主界面中
[ECServiceSdk showElvaOP:@"TEST_PLAYER_NAME"
               PlayerUid:@"TEST_UID_123"
                ServerId:@"TEST_SRV_ID_123"
           PlayerParseId:@""
PlayershowConversationFlag:@"1"
                  Config:config];

//如果是在FAQ列表页面中进入机器人
[ECServiceSdk setUserName:@"PLAYER_NAME"];  //需要调用此方法
[ECServiceSdk setUserId:@"123ABC567DEF"];   //需要调用此方法
[ECServiceSdk showFAQs:config];

最佳实践:

引导用户从不同入口看到不同的服务

14.设置人工客服界面的另一个欢迎语

如果您想定制人工客服的欢迎语,您需要在调用对应接口的config参数里传入一对新的key,value key是:"private_welcome_str",value为您想要的定制的内容 代码示例:

NSMutableDictionary *customData = [NSMutableDictionary dictionary];//定义自定义参数容器
// 注:private_welcome_str是key,不能改变。需要改变的是usersay
[customData setObject:@"usersay" forKey:@"private_welcome_str"]; //添加自定义人工欢迎语

NSMutableDictionary *config = [NSMutableDictionary dictionary]; //定义config参数容器
[config setObject:customData forKey:@"elva-custom-metadata"]; //将customData存入容器

[ECServiceSdk showElva:@"TEST_PLAYER_NAME"
             PlayerUid:@"TEST_UID_123"
              ServerId:@"TEST_SRV_ID_123"
         PlayerParseId:@""
PlayershowConversationFlag:@"1"
                Config:config];

最佳实践:

引导用户从不同入口看到不同的服务

15.设置视图控制器以弹出'AIHelp' , use setRootViewController:

代码示例:

[ECServiceSdk setRootViewController:viewController];

参数说明:

参数 说明
viewController 设置视图控制器以弹出'aihlep'

最佳实践:

  1. 如果存在多个window,且直接调用showElva等接口,页面无法弹出时,调用此接口

16.客服系统横竖屏方向设置

步骤一,设置方向权限

方法1:在项目的General->Deployment Info->Device Orientation中勾选设备所需支持的设备方向 PortraitUpside DownUpside DownLandscape Right

方法二:在Appdelegate中实现application:supportedInterfaceOrientationsForWindow:方法,并返回设备所需支持的设备方向

- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
    return UIInterfaceOrientationMaskAll;
}

注意
1:表单中上传图片使用了系统的相机和相册功能,必须要开启竖屏选项权限,否则在调用系统相机功能会导致应用crash
2:如果游戏是横屏的,并开启了竖屏权限影响了游戏的方向,可以在RootViewController.m文件中添加supportedInterfaceOrientations方法,并返回游戏的支持方向

- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskLandscape;
}
步骤二,设置SDK方向

代码示例:

//示例1:设置SDK显示方向支持所有方向
[ECServiceSdk setSDKInterfaceOrientationMask:UIInterfaceOrientationMaskAll];

//示例2:设置SDK显示方向为横屏
[ECServiceSdk setSDKInterfaceOrientationMask:UIInterfaceOrientationMaskLandscape];

//示例3:设置SDK显示方向为竖屏
[ECServiceSdk setSDKInterfaceOrientationMask:UIInterfaceOrientationMaskPortrait];

参数参考

typedef NS_OPTIONS(NSUInteger, UIInterfaceOrientationMask) {
    UIInterfaceOrientationMaskPortrait,         // 设备(屏幕)直立
    UIInterfaceOrientationMaskLandscapeLeft,    // 设备(屏幕)向左横置
    UIInterfaceOrientationMaskLandscapeRight,   // 设备(屏幕)向右橫置
    UIInterfaceOrientationMaskPortraitUpsideDown,// 设备(屏幕)直立,上下顛倒
    UIInterfaceOrientationMaskLandscape,        // 设备(屏幕)横置,包含向左和向右   
    UIInterfaceOrientationMaskAll,              // 设备(屏幕)可以支持上下左右四个方向
    UIInterfaceOrientationMaskAllButUpsideDown  // 设备(屏幕)可以支持上左右三个个方向,但不支持直立上下颠倒
}

LICENSE

Copyright 2015 ShareFun Network Limited.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: You must give any other recipients of the Work or Derivative Works a copy of this License; and You must cause any modified files to carry prominent notices stating that You changed the files; and You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS

简介

暂无描述 展开 收起
Apache-2.0
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/z7gamestudio/AIHelp-iOS-SDK.git
git@gitee.com:z7gamestudio/AIHelp-iOS-SDK.git
z7gamestudio
AIHelp-iOS-SDK
AIHelp-iOS-SDK
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891