VerloopSDK 0.1.2

VerloopSDK 0.1.2

测试已测试
Lang语言 SwiftSwift
许可证 MIT
Released最后发布2017年6月
SwiftSwift 版本3.0
SPM支持 SPM

Maintained by Prashant.



  • 作者:
  • Verloop

VerloopSDK

安装

VerloopSDK 可通过 CocoaPods 获得。要安装它,只需将以下行添加到您的 Podfile:

    pod "VerloopSDK"

然后,运行以下命令:

    $pod install

用法

  1. 在应用程序的 application:didFinishLaunchingWithOptions 中初始化 Verloop。
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    let notificationSettings = UIUserNotificationSettings(types: [UIUserNotificationType.badge, UIUserNotificationType.sound, UIUserNotificationType.alert], categories: nil)
    application.registerUserNotificationSettings(notificationSettings)


    let config = VerloopConfig.init(subDomain: "name.stage", token: "test");
    config.name = "testName"
    config.email = "testEmail"
    config.msisdn = "testNumber"
    Verloop.sharedInstance.register(withConfig: config);
    return true
}
  1. 在 application:didRegisterForRemoteNotificationsWithDeviceToken 中更新设备令牌。
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
    let deviceTokenString = deviceToken.reduce("", {$0 + String(format: "%02X", $1)})
    Verloop.sharedInstance.updateDeviceToken(withDeviceToken: deviceTokenString);
}
  1. 处理通知
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any]) {
    if Verloop.sharedInstance.isVerloopNotif(wihtNotif: userInfo) {
        Verloop.sharedInstance.handleNotif(withNotif: userInfo)
    }
}
  1. 启动实时聊天
    Verloop.sharedInstance.showConversation()

作者

Verloop, [email protected]

许可证

VerloopSDK 在 MIT 许可证下可用。有关更多信息,请参阅 LICENSE 文件。