DubaiPoliceBot 0.5.5

DubaiPoliceBot 0.5.5

DubaiPolice 维护。



 
依赖项
GooglePlaces>= 0
GooglePlacePicker>= 0
GoogleMaps>= 0
Alamofire>= 0
AlamofireImage>= 0
NVActivityIndicatorView>= 0
SocketRocket>= 0
SVProgressHUD>= 0
SwiftyJSON>= 0
 

  • Imagine

LabibaBotClient

CI Status Version License Platform

Swift 库,用于将 Labiba 聊天机器人添加到您的 iOS 应用程序中

示例

要运行示例项目,请首先克隆仓库,然后从示例目录中运行 pod install

需求

  • Xcode 8.0+
  • iOS 9.0+
  • Swift 3.3

安装

LabibaBotClient 通过 CocoaPods 提供。要安装它,只需简单地将以下行添加到您的 Podfile 中:

platform :ios, '9.0'

source 'https://{YOUR_BITBUCKET_USERNAME}@bitbucket.org/imaginejo/specs.git'
source 'https://github.com/CocoaPods/Specs.git'

target 'YOUR_APP_TARGET' do
  use_frameworks!

  # Pods for YOUR_APP_TARGET
  pod 'LabibaBotClient'
end

首先,将此仓库克隆到某个文件夹中,例如 "path/to/yourworkspace"。

cd path/to/yourworkspace
git clone https://{YOUR_USER_NAME}@bitbucket.org/imaginejo/labibabotclient_ios.git

然后,简单地在您的 Podfile 中添加以下行

use_frameworks!
platform :ios, '9.0'

target 'YOUR_APP_TARGET' do
    pod 'LabibaBotClient', :path => 'path/to/yourworkspace/labibabotclient_ios'
end

使用

配置

在展示 Labiba 聊天界面之前,您必须先进行配置和自定义。您应该在应用启动时尽早进行此操作。在您的 AppDelegate.swift 中添加以下行

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

    Labiba.initialize(pageId: "310363199529584", botName: "bot-name".local)
    Labiba.setSenderId( "1764343183643935")
    Labiba.setBotAvatar( #imageLiteral(resourceName: "imagine_logo"))
    Labiba.setTintColor( #colorLiteral(red: 0.2501407726, green: 0.6199833439, blue: 0.4300507522, alpha: 1))
    // Labiba.setBasePath( ... ) //In case, you need it
    // Labiba.setUserAvatar( ... )

    return true
}
  • pageId:可以在 Labiba 管理系统中设置 iOS 渠道时获取。

  • Labiba.setSenderId(_ senderId:String):您应该在启动聊天界面之前在应用中某个地方调用此方法,并且必须为每个应用用户唯一。一个可能的用例是,通过您的后端应用程序生成它,然后将其传递给应用程序以供 Labiba 使用,这样做可以允许您的系统与 Labiba 聊天机器人系统之间更好地集成。

启动机器人

可移动别名

用户通过触摸它来启动对话,请看下面的内容

override func viewDidAppear(_ animated: Bool) {

    super.viewDidAppear(animated)
    Labiba.showMovableAlias(corner: .bottomRight, animated: true)
}

会话 UIViewController

您可以将其放置在任何需要的位置(导航控制器、标签栏控制器等),只需使用以下方法来创建它

Labiba.createConversation()

警告

在启动 Labiba 聊天机器人之前,您必须在应用程序的某个点调用 Labiba.setSenderId( _ senderId:String ) 方法。请参阅 配置 部分。


作者

Suhayb Al-Absi,[email protected]

许可证

版权所有归 Labiba.ai,2018。