第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

沒有收到來自 firebase 的推送通知但使用 Pusher 應用程序

沒有收到來自 firebase 的推送通知但使用 Pusher 應用程序

守候你守候我 2022-06-15 16:49:08
我沒有從 firebase 收到任何通知,但是當我使用 Pusher 應用程序進行測試時,我收到了通知。這些是我已經完成的步驟。如果我做錯了什么,請幫助我。1_添加如下通知服務。class NotificationService: UNNotificationServiceExtension {var contentHandler: ((UNNotificationContent) -> Void)?var bestAttemptContent: UNMutableNotificationContent?override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {    self.contentHandler = contentHandler    bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent)    if let bestAttemptContent = bestAttemptContent {        // Modify the notification content here...        bestAttemptContent.title = "hello"        bestAttemptContent.body = "this is test"        contentHandler(bestAttemptContent)    }}}2 _ 在應用程序委托中將 notificationCenter 委托設置為 self        Messaging.messaging().delegate=self        UNUserNotificationCenter.current().delegate = self3_ 用于發(fā)送通知的設備令牌(我將其存儲到服務器)   func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String) {    print("Firebase registration token: \(fcmToken)")    let dataDict:[String: String] = ["token": fcmToken]    NotificationCenter.default.post(name: Notification.Name("FCMToken"), object: nil, userInfo: dataDict)    // TODO: If necessary send token to application server.    // Note: This callback is fired at each app startup and whenever a new token is generated.}我將此 FCMToken 發(fā)送到服務器端(java,spring boot)4_ 我在功能中啟用了推送通知5_ 我在 Firebase 控制臺的項目設置的云消息傳遞中添加了 .p12 文件,但我對此有很大的疑問??????我應該使用我的服務器帳戶登錄到 firebase 嗎?或者為我自己做一個帳戶??因為我為自己創(chuàng)造了一個。一些技巧 :我們是一個像服務器端(JAVA)這樣的團隊。網頁、安卓和ios此推送通知適用于 android 但不適用于 ios。我想我在做錯事。感謝您閱讀本主題并幫助我。
查看完整描述

1 回答

?
HUWWW

TA貢獻1874條經驗 獲得超12個贊

這是交叉檢查您的問題的步驟,

  1. 必須啟用通知功能。

  2. 您在蘋果會員中心創(chuàng)建的證書應該啟用推送通知

http://img1.sycdn.imooc.com//62a99d1f00017f1e07330455.jpg

在 Firebase 控制臺中轉到設置 -> 項目設置 -> 云消息傳遞 -> 檢查服務器密鑰

  1. 這個密鑰和你給服務器團隊的密鑰應該是一樣的

  2. 檢查是否添加了 APNs 身份驗證密鑰或 APNs 證書。

  3. 如果您使用的是 APNs 證書,則應該與您在會員中心的 appId 中生成的證書相同

http://img1.sycdn.imooc.com//62a99d2b0001998f06080151.jpg

  1. 從 xcode 控制臺獲取 fcm 令牌 -> 轉到 firebase 控制臺 -> 增長 -> 云消息傳遞 -> 新通知 -> 并嘗試在設備上進行測試。如果您收到通知客戶端(設備)沒有問題。如果不是服務器端必須仔細檢查服務器密鑰。

  2. 將您的 googleServiceInfo.plist 添加到您的項目中。在您的應用信息中添加反向密鑰。

  3. Appdelegate,配置你的火力基地 FirebaseApp.configure()

更新,根據(jù)您在評論中的問題,我正在更新這個問題。要使用 NotificationService 擴展,您的通知必須mutable-content在通知負載中包含屬性。使用 fcm api 你可以做到這一點。把這些放在郵遞員那里,

https://fcm.googleapis.com/fcm/send

在標題中,添加您的服務器密鑰(您可以從您的 firebase 控制臺獲?。?/p>

在此處輸入圖像描述

在正文中添加此有效負載以觸發(fā)通知。這將觸發(fā)您的通知服務擴展。

{
    "notification": {
        "title": "1",
        "body": "",
        "click_action": "",
        "icon": "",
        "mutable_content": true,
        "content_available": true
    },
    "registration_ids":["add your fcm token"],
    "data": {}}

在此處輸入圖像描述

根據(jù)教程: https ://code.tutsplus.com/tutorials/ios-10-notification-service-extensions--cms-27550

在此處輸入圖像描述


查看完整回答
反對 回復 2022-06-15
  • 1 回答
  • 0 關注
  • 193 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號