【问题标题】:Is there a replacement for using NSNotificationCenter and kFIRInstanceIDTokenRefreshNotification to detect expired tokens?是否可以替代使用 NSNotificationCenter 和 kFIRInstanceIDTokenRefreshNotification 来检测过期令牌?
【发布时间】:2020-11-24 15:59:18
【问题描述】:

我正在迁移一些使用现已弃用的旧 Crashlytics 代码

[FIRInstanceID instanceIDWithHandler:]使用新方法

[FIRInstallations installationIDWithCompletion:] 方法。

与该清理相关的是弃用警告:'kFIRInstanceIDTokenRefreshNotification' is deprecated

过去,我们使用该名称向NSNotificationCenter 添加了一个观察者,以便在instanceID 过期时收到通知,以便我们可以请求一个新的。

新安装 ID 是否有类似的概念?我在 the relevant Firebase documentation 中找不到任何关于替代品的参考,但我想知道我是否只是忽略了某些东西?

【问题讨论】:

  • doc I found re: that notification 并没有说它已被弃用(但我打赌你知道)你能发布那个警告的来源吗?您可以在日志导航器 > 特定构建中找到它。

标签: ios firebase crashlytics


【解决方案1】:

我在 Firebase 库中四处寻找更有用的弃用消息。我在FIRInstanceID找到了这个:

__deprecated_msg("FIRInstanceID is deprecated, please use FIRInstallations for installation "
                 "identifier handling and use FIRMessaging for FCM registration token handling.")

在查看 FIRInstallations.h 和 FIRMessaging.h 之后,看起来他们已经用两个替换了一个通知名称:

  • FIRMessagingRegistrationTokenRefreshedNotification
  • FIRInstallationIDDidChangeNotification

因此,如果您担心安装标识符的更改,您可能希望为FIRInstallationIDDidChangeNotification 添加一个观察者到 NSNotificationCenter。

【讨论】:

    猜你喜欢
    • 2021-12-21
    • 2016-07-20
    • 2015-10-20
    • 2018-12-19
    • 2014-12-19
    • 2020-02-23
    • 2012-05-23
    • 2023-03-27
    • 1970-01-01
    相关资源
    最近更新 更多