2016-09-19 102 views
0

我跟隨了文檔,併成功註冊了Sendbird的推送通知(上傳的.p12 dev證書+註冊設備令牌與Sendbird SDK等),但沒有收到任何通知。Sendbird不推送iOS上的通知

func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) { 

    NSUserDefaults.standardUserDefaults().setObject(deviceToken, forKey: "deviceToken") 

    SBDMain.registerDevicePushToken(deviceToken) { (status, error) in 
     if error == nil { 
      if status == SBDPushTokenRegistrationStatus.Pending { 

       SBDMain.connectWithUserId("\(UserDataStore.ownerProfile?.id!)", completionHandler: { (user, error) in 

        SBDMain.registerDevicePushToken(SBDMain.getPendingPushToken()!, completionHandler: { (status, error) in 
         print("Sendbird Registration Succeeded 2nd attempt") 
        }) 
       }) 

      } else { 
       print("Sendbird Registration Succeeded") 
      } 
     } else { 
      print("Sendbird Push Registration Failed") 
     } 
    } 
} 

在我didreceive ...我沒有得到任何東西。

func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) { 

    if let aps = userInfo["aps"] as? NSDictionary { 
     if let alert = aps["alert"] as? NSDictionary { 
      if let message = alert["message"] as? NSString { 
       print(message) 
      } 
     } else if let alert = aps["alert"] as? NSString { 
      print(alert) 
     } 
    } 

    if application.applicationState == .Inactive { 
     NSNotificationCenter.defaultCenter().postNotificationName("pushNotificationReceived", object: nil) 
    } else { 
    NSNotificationCenter.defaultCenter().postNotificationName("pushNotificationReceivedActive", object: nil) 
    } 
} 

我已經完成了過去的推送通知,並且熟悉了這個過程。事實上,我剛剛通過Firebase雲消息進行了測試,推送工作正常。如果任何人都可以提供幫助,將不勝感激......我很好奇,看看是否有任何額外的步驟需要採取與Sendbird。

更新:我已經聯繫了Sendbird,問題在於他們的儀表板上傳.p12文件的錯誤;刪除文件並重新上傳修復了問題。該錯誤已被修補。

回答

0

只有在用戶離線時,SendBird纔會向用戶發送推送通知。

請確認您是否向離線用戶發送了消息。 (例如按回家按鈕讓應用程序在後臺運行,以便它從SendBird變爲離線)