测试已测试 | ✓ |
语言语言 | Obj-CObjective C |
许可 | 商业 |
发布最后发布 | 2017年2月 |
由 Nicolas Lauquin 维护。
依赖 | |
SocketRocket | = 0.5.1 |
Base64 | = 1.1.2 |
DoYouDreamUp SDK 是一个简单的实现,由 DoYouDreamUp 提供用于通过 websocket 服务器进行实时通信和交换的虚拟助手。
#import <DoYouDreamUp/DoYouDreamUp.h>
didFinishLaunchingWithOptions
中设置您的令牌和服务器信息[[DoYouDreamUpManager sharedInstance] configureWithDelegate:self
botId:@"972f1264-6d85-4a58-b5ac-da31481dda63"
space:nil
language:@"FR"
testMode:false
solutionUsed:Assistant
pureLivechat:false
serverUrl:@"wss://jp.createmyassistant.com/servlet/chat"
backupServerUrl:nil];
DoYouDreamUpDelegate
协议和其强制方法///Callback to notify that the connection failed with the given error
///@param error the given error
-(void) dydu_connexionDidFailWithError:(nonnull NSError *)error {}
///Callback to notify that the connection closed correctly
-(void) dydu_connexionDidClosed {}
///Callback to notify that the connection opened
///@param contextId the contextId used in the current connexion
-(void) dydu_connexionDidOpenWithContextId:(nullable NSString*)contextId {}
[[DoYouDreamUpManager sharedInstance] connect];
[[DoYouDreamUpManager sharedInstance] talk:@"Hi, can you help me?"];
-(void) dydu_receivedTalkResponseWithMsg:(nonnull NSString*)message withExtraParameters:(nullable NSDictionary*)extraParameters {}
您已经准备好测试和使用解决方案!在聊天服务周围构建任何 UI。
Go to File>New>File.. and add a new header file called `[AppNameHere]-Bridging-Header.h.
#import <DoYouDreamUp/DoYouDreamUp.h>
application:didFinishLaunchingWithOptions:
(Swift 2.3 风格)中设置您的令牌和服务器信息import DoYouDreamUp
DoYouDreamUpManager.sharedInstance().configureWithDelegate(self,
botId: "972f1264-6d85-4a58-b5ac-da31481dda63",
consultationSpace: nil,
language: "FR",
testMode:true,
solutionUsed: Assistant,
pureLivechat: false,
serverUrl:"wss://jp.createmyassistant.com/servlet/chat",
backupServerUrl:nil)
DoYouDreamUpDelegate
协议和其强制方法///Callback to notify that the connection failed with the given error
///@param error the given error
func dydu_connexionDidFailWithError(error: NSError) {}
///Callback to notify that the connection closed correctly
func dydu_connexionDidClosed() {}
///Callback to notify that the connection opened
///@param contextId the contextId used in the current connexion
func dydu_connexionDidOpenWithContextId(contextId:String?) {}
DoYouDreamUpManager.sharedInstance().connect()
DoYouDreamUpManager.sharedInstance().talk("Hi, can you help me?"])
实现回调代理
func dydu_receivedTalkResponseWithMsg(message: String, withExtraParameters extraParameters: [NSObject : AnyObject]?) {}
您已经准备好测试和使用解决方案!在聊天服务周围构建任何 UI。
提供三个演示项目,包括swift & objc。具体包括:
推荐使用CocoaPods进行安装,它是Cocoa项目的依赖管理器。Pods可以让您在Xcode项目中下载并集成DoYouDreamUp SDK,耗时不到1分钟。
您可以使用以下命令安装CocoaPods:
$ gem install cocoapods
构建DoYouDreamUp 1.0.0+需要CocoaPods 0.39.0+。
要使用CocoaPods将DoYouDreamUp集成到您的Xcode项目中,请在您的《Podfile》中指定它。
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
pod 'DoYouDreamUp', '~> 1.0.8'
然后,运行以下命令:
$ pod install
此SDK是DoYouDreamUp websocket接口的简单包装,您可能需要查阅接口文档。
默认情况下不显示日志,除非错误。要启用它,请执行以下操作:
[DoYouDreamUpManager displayLog:true];