ios - Localytics ios 推送设备 token

标签 ios apple-push-notifications localytics

我已经使用 Localytics 实现了 iOS 推送通知,它正在运行,但我对他们如何捕获 deviceToken 感到困惑。

documentation指示我调用 registerForRemoteNotifications 以获取设备 token 。好吧,这是标准的。但是文档没有说明如何处理应用程序委托(delegate)回调 didRegisterForRemoteNotificationsWithDeviceToken。我假设一旦返回 token ,我将需要调用 SDK 中名为 setPushToken 的类方法。这将是合乎逻辑的事情。但是,它似乎在 didRegisterForRemoteNotificationsWithDeviceToken 中没有任何代码的情况下工作。他们是否以某种方式拦截此应用程序委托(delegate)消息并将 token 传递给他们的服务器?这是预期的行为吗?如果是这样,SDK中setPushToken的作用是什么?

最佳答案

在 v 4.1 中,他们似乎用自己的一个代理 AppDelegate。 来自他们的 autoIntegrate(appKey: String, launchOptions: [NSObject : AnyObject]?) 文档:

Use this method to automatically integrate the Localytics SDK in a single line of code. Automatic integration is accomplished by proxing the AppDelegate and "inserting" a Localytics AppDelegate behind the applications AppDelegate. The proxy will first call the applications AppDelegate and then call the Localytics AppDelegate.

如果你不使用SDK的自动集成,你应该自己调用所有方法,包括setPushToken

但是,似乎有些回调没有被正确调用,例如我根本没有得到任何 didRegisterForRemoteNotificationsWithDeviceToken,而且我无法在其他 SDK 上设置任何推送 token 。 如果我删除自动集成,一切都会按预期工作。

关于ios - Localytics ios 推送设备 token ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39430916/

相关文章:

ios - deinit 未调用 subview Controller

ios - 将值从按钮添加到 UILabel

php - 检查 iOS Device Token 是否有效

android studio jar 文件是红色的?

android - 移动分析中的事件持续时间?

ios - CATextLayer 上来自 iOS 6 的不需要的垂直填充

ios - 如何提供高级 API 调用安全性 - iOS

xamarin.ios - Azure 通知中心和 Apple APNS 推送通知取消注册设备

apple-push-notifications - SendEmptyPushNotification 到 gateway.push.apple.com 不再工作

ios - iOS 上的 Flurry/Google Analytics/Localytics 带宽消耗