Hi there.
I am struggling with displaying push notifications sent from my Firebase console in my app. It obviously shows when my phone screen is locked, but I can't seem to get this working. I honestly have to say that I am also a bit confused, and I would really appreciate if any could help me with this.
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
let token = FIRInstanceID.instanceID().token()
FIRMessaging.messaging().appDidReceiveMessage(userInfo)
print(token)
print("MessageID : \(userInfo["gcm_message_id"])")
print(userInfo)
}
It's in here I have put the code for the foreground push notification as well. So it looks like this:
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
let token = FIRInstanceID.instanceID().token()
FIRMessaging.messaging().appDidReceiveMessage(userInfo)
print(token)
print("MessageID : \(userInfo["gcm_message_id"])")
print(userInfo)
let notification = BSForegroundNotification(userInfo: userInfo)
BSForegroundNotification.systemSoundID = 1004
notification.delegate = self
notification.presentNotification()
}
However, this does not seem to work. Any ideas on how I would solve this?