# 工具方法

为了方便接入和调试,我们提供了一些工具类 API,你可以根据情况自行选择。

# enableLogging

是否打开日志

[AIHelpSupportSDK enableLogging:YES];

# getSDKVersion

获取当前 AIHelp 版本信息

NSString* sdkVersion = [AIHelpSupportSDK getSDKVersion];

# isAIHelpShowing

当前展示的是否为 AIHelp 页面

bool isShowing = [AIHelpSupportSDK isAIHelpShowing];

# setOnSpecificUrlClickedCallback

利用此 API 来接管某个超链接的点击事件,具体配置方法如下:

1、为超链接配置 js-bridge=enable 参数,如:https://www.google.com?js-bridge=enable

2、设置回调来接管配置了 js-bridge=enable 的超链接的点击事件:

void onSpecificUrlClickedCallback(const char * url){
    // url: https://www.google.com?js-bridge=enable
    // You can get the callback when user clicked the specific url
}

[AIHelpSupportSDK setOnSpecificUrlClickedCallback: onSpecificUrlClickedCallback];

# setOnAIHelpSessionOpenCallback

注册 AIHelp 页面打开的回调通知:

void openSDKCallBack() {
    // You can get the callback when user opened the AIHelp page
}
[AIHelpSupportSDK setOnAIHelpSessionOpenCallback:openSDKCallBack];

# setOnAIHelpSessionCloseCallback

注册 AIHelp 页面关闭的回调通知:

void closeSDKCallBack() {
    // You can get the callback when user closed the AIHelp page
}
[AIHelpSupportSDK setOnAIHelpSessionCloseCallback:closeSDKCallBack];

# setOnOperationUnreadChangedCallback

注册运营文章更新时的回调通知:

void opUnreadCallBack(bool hasUnreadArticles) {
    // do something you want according to the unread status received
}
[AIHelpSupportSDK setOnOperationUnreadChangedCallback:opUnreadCallBack];

# additionalSupportFor

为以下国家或地区提供额外的域名支持:

  • 印度地区
  • 中国大陆地区

需要注意的是,此方法必须在 init 开始之前调用,如下所示:

if (USER_FROM_MAINLAND_CHINA) {
  [AIHelpSupportSDK additionalSupportFor:AIHelpCN];
}
[AIHelpSupportSDK initWithApiKey:@"THIS IS YOUR APP KEY"
                  domainName:@"THIS IS YOUR APP DOMAIN"
                  appId:@"THIS IS YOUR APP ID"
                  language:@"THIS IS YOUR DEFAULT LANGUAGE(OPTIONAL)"];
上次更新: 11/9/2023, 3:01:09 AM