是否可以替代使用 NSNotificationCenter 和 kFIRInstanceIDTokenRefreshNotification 来检测过期令牌?
Posted
技术标签:
【中文标题】是否可以替代使用 NSNotificationCenter 和 kFIRInstanceIDTokenRefreshNotification 来检测过期令牌?【英文标题】:Is there a replacement for using NSNotificationCenter and kFIRInstanceIDTokenRefreshNotification to detect expired tokens? 【发布时间】: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 并没有说它已被弃用(但我打赌你知道)你能发布那个警告的来源吗?您可以在日志导航器 > 特定构建中找到它。 【参考方案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。
【讨论】:
以上是关于是否可以替代使用 NSNotificationCenter 和 kFIRInstanceIDTokenRefreshNotification 来检测过期令牌?的主要内容,如果未能解决你的问题,请参考以下文章
深度学习系列 | Global Average Pooling是否可以替代全连接层?
是否有 numpy.save(file, arr) 可以与 pypy 一起使用的替代方法?
是否可以使用 CListCtrl 编辑数据 - 如果没有,任何人都可以建议 MFC 中的替代控件吗?
是否有任何开发模式可以替代网络请求的 IntentService?