迪拜警察 0.3.2

迪拜警察 0.3.2

迪拜警察维护。



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

  • 想象

LabibaBotClient

CI Status Version License Platform

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

示例

要运行示例项目,请克隆仓库,然后首先从示例目录中运行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):您应该在启动聊天界面之前某个时刻调用此函数,并且每个应用程序用户必须是唯一的。一个可能的用例是由您的后端应用程序生成此ID,并将其传递给您的应用程序用于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。