【问题标题】:Postman - Firebase notification iosPostman - Firebase 通知 ios
【发布时间】:2016-08-24 22:15:11
【问题描述】:

我尝试使用 Postman 将 POST 发送到 firebase,但出现错误:

<HTML>
    <HEAD>
        <TITLE>Unauthorized</TITLE>
    </HEAD>
    <BODY BGCOLOR="#FFFFFF" TEXT="#000000">
        <H1>Unauthorized</H1>
        <H2>Error 401</H2>
    </BODY>
</HTML>

这是我的正文和标题。 对于授权我不确定,我放了我的 ios firebase 项目的 api 服务器密钥。 我想发送它并在我的设备上显示通知。

感谢您的帮助。

当我使用 xcode 启动应用程序时,我无法感染 APNS,但最后:连接到 FCM。

<FIRAnalytics/INFO> Firebase Analytics v.3200000 started
2016-08-25 07:58:06.690 HelloCordova[2426:] <FIRAnalytics/INFO> To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled
2016-08-25 07:58:06.741 HelloCordova[2426:671139] Firebase Crash Reporting: Successfully enabled
2016-08-25 07:58:06.754: <FIRInstanceID/WARNING> FIRInstanceID AppDelegate proxy enabled, will swizzle app delegate remote notification handlers. To disable add "FirebaseAppDelegateProxyEnabled" to your Info.plist and set it to NO
2016-08-25 07:58:06.755: <FIRInstanceID/WARNING> Failed to fetch APNS token Error Domain=com.firebase.iid Code=1001 "(null)"
2016-08-25 07:58:06.764: <FIRMessaging/INFO> FIRMessaging library version 1.1.0
2016-08-25 07:58:06.776: <FIRMessaging/WARNING> FIRMessaging AppDelegate proxy enabled, will swizzle app delegate remote notification receiver handlers. Add "FirebaseAppDelegateProxyEnabled" to your Info.plist and set it to NO
2016-08-25 07:58:06.780 HelloCordova[2426:] <FIRAnalytics/INFO> Successfully created Firebase Analytics App Delegate Proxy automatically. To disable the proxy, set the flag FirebaseAppDelegateProxyEnabled to NO in the Info.plist
2016-08-25 07:58:07.361: <FIRInstanceID/WARNING> APNS Environment in profile: development
2016-08-25 07:58:07.574 HelloCordova[2426:671139] Resetting plugins due to page load.
2016-08-25 07:58:07.796 HelloCordova[2426:] <FIRAnalytics/INFO> Firebase Analytics enabled
2016-08-25 07:58:07.819 HelloCordova[2426:671139] Connected to FCM.
2016-08-25 07:58:08.316 HelloCordova[2426:671139] Finished load of: file:///var/containers/Bundle/Application/1DE45D4B-AFB3-4F6D-83D7-71D1A6FE8F44/HelloCordova.app/www/index.html#/connected
2016-08-25 07:58:10.094 HelloCordova[2426:671139] THREAD WARNING: ['GoogleMaps'] took '472.765137' ms. Plugin should use a background thread.
2016-08-25 07:58:33.836 HelloCordova[2426:671139] Received memory warning.

【问题讨论】:

  • 如您所见,它没有给我 FCM 连接的令牌

标签: ios firebase push-notification postman firebase-cloud-messaging


【解决方案1】:

在Postman 的Authorization 标签中,您需要输入key=YOUR_SERVER_KEY 之类的格式。

要获取 Server Key:在 firebase 控制台中转到您的项目设置。 单击云消息传递并复制该页面中提到的Server Key。

【讨论】:

【解决方案2】:

在代码中的任何位置使用此行打印设备令牌

print("Token \(FIRInstanceID.instanceID().token()!)")

参考下图通过 Postman 发送推送通知

【讨论】:

    猜你喜欢
    • 2020-05-26
    • 1970-01-01
    • 2018-06-18
    • 2020-07-31
    • 2017-08-01
    • 1970-01-01
    • 2018-07-06
    • 2017-06-16
    • 1970-01-01
    相关资源
    最近更新 更多