I've followed the docs and have successfully registered for push notifications with Sendbird (uploaded .p12 dev certificate + register device token with Sendbird SDK, etc) but am not getting any notifications.
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")
}
}
}
In my didReceive...I'm not getting anything.
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)
}
}
I've done push notifications in the past and am familiar with the process. In fact, I just tested out with Firebase Cloud Messaging and the push works fine with their service. If anyone can help, would be greatly appreciate it...I'm curious to see if there are any additional steps that needs to be taken with Sendbird.
UPDATE: I've reached out to Sendbird and the problem was a bug on their dashboard where you upload the .p12 file; deleting the file and re-uploading fixes the problem. The bug has been patched since.