Ios Firebase,事件KfiristancedTokenRefreshNotification从未激发
我在事件KfiristanceidTokenRefreshNotification上添加了一个观察者Ios Firebase,事件KfiristancedTokenRefreshNotification从未激发,ios,objective-c,firebase,firebase-cloud-messaging,nsnotificationcenter,Ios,Objective C,Firebase,Firebase Cloud Messaging,Nsnotificationcenter,我在事件KfiristanceidTokenRefreshNotification上添加了一个观察者 [FIRApp configure]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(tokenRefreshNotification:) name:kFIRInstanceIDTokenRefreshNotification objec
[FIRApp configure];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(tokenRefreshNotification:)
name:kFIRInstanceIDTokenRefreshNotification object:nil];
[[FIRInstanceID instanceID] token] => It's null at this moment
我通过postNotificationName向自己发送KfiristancedTokenRefreshNotification事件来检查是否一切都配置良好,我收到该事件就是为了工作
我从iphone中删除应用程序,以确保必须重新创建令牌
在执行addObserver之后,我检查了[[FIRInstanceID instanceID]标记]
和它是空的,因此可以肯定它将在以后创建
但是,kFIRInstanceIDTokenRefreshNotification
永远不会被触发:(我等待几秒钟,然后再次检查[[FIRInstanceID instanceID]令牌]
并且它不再为空,但是没有触发kFIRInstanceIDTokenRefreshNotification
:(
你知道怎么了吗
注意:我不知道这是否有关系,但因为我不在xcode下,我在Delphi下,我不使用常量
FOUNDATION_EXPORT NSString * __nonnull const kFIRInstanceIDTokenRefreshNotification;
但请使用我自己的NSString值,该值正好包含“KfiristanCeidTokenRefreshNotification”
知道问题可能出在哪里吗?只有在最初创建或刷新令牌时,观察者才会触发。看起来您是在这之后为观察者添加代码的 这是您应该在两个位置处理令牌的原因之一:
- 在你的
- 借