Firebase 刷新令牌

2023-07-28移动开发问题
3

本文介绍了Firebase 刷新令牌的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

使用方法

[FIRInstanceID tokenWithAuthorizedEntity:scope:options:handler]

我不太确定参数要求什么?授权实体和行动是什么?我是否也将 Apple 的 APNS 令牌传递给该方法?

Im not quite sure what the parameters are calling for? What is the authorized entity and action? Also do I pass in the APNS token from apple to that method?

推荐答案

  1. AUTHORIZED_ENTITY - 基本上它要求提供 google 项目 ID.它是数字的,如果您之前已经在项目中集成了 GCM,它将是 GCM_SENDER_ID(类似于568520103762").检查您的 Google-info.plist 以找到它.
  2. 范围 - kFIRInstanceIDScopeFirebaseMessaging
  3. OPTIONS - @{@"apns_token": deviceToken}(您将在 didRegisterForRemoteNotifications 方法中获取 DeviceToken)
  4. HANDLER - 如果您收到令牌,则捕获令牌或在此处捕获错误.如果token为nil,则在tokenRefreshNotification"方法中等待token,如果[FIRInstanceID tokenWithAuthorizedEntity:scope:options:handler]中token为nil则自动调用该方法

例子:

 if (![[FIRInstanceID instanceID] token]) {
    [[FIRInstanceID instanceID] tokenWithAuthorizedEntity:_gcmSenderId scope:kFIRInstanceIDScopeFirebaseMessaging options:_registrationOptions handler:^(NSString * _Nullable token, NSError * _Nullable error) {

        // Fetch the token or error
    }];

}

这篇关于Firebase 刷新令牌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

硬件音量按钮更改应用程序音量
Hardware Volume buttons change in app volume(硬件音量按钮更改应用程序音量)...
2024-08-12 移动开发问题
10

Cocos2d - 如何检查不同层中对象之间的交集
Cocos2d - How to check for Intersection between objects in different layers(Cocos2d - 如何检查不同层中对象之间的交集)...
2024-08-12 移动开发问题
8

恢复游戏 cocos2d
Resume game cocos2d(恢复游戏 cocos2d)...
2024-08-12 移动开发问题
6

Cocos2D + 仅禁用 Retina iPad 图形
Cocos2D + Disabling only Retina iPad Graphics(Cocos2D + 仅禁用 Retina iPad 图形)...
2024-08-12 移动开发问题
10

如何将 32 位 PNG 转换为 RGB565?
How to convert 32 bit PNG to RGB565?(如何将 32 位 PNG 转换为 RGB565?)...
2024-08-12 移动开发问题
21

正确的 cocos2d 场景重启?
Proper cocos2d scene restart?(正确的 cocos2d 场景重启?)...
2024-08-12 移动开发问题
7