swiftpush-notificationsilent-notification

Silent Push Notifications in iOS 14 and 15


in my app I have implemented silent notifications with Firebase Cloud Messaging, I receive message and handle them with:

    public func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
    // Silent push notifications
}

But start from iOS 14 I notifications don't come and don't handle when app is turned off fully.

Is there way to get notifications in iOS 14 and 15?


Solution

  • Ran into a similar issue when trying to push silent notifications from firebase to Apple devices. A workaround is to use APNs (Apple Push Notification Service) directly. This works reliably in my experience.

    Read on how to push notifications using APNs here: https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/sending_notification_requests_to_apns/

    Read on how to push silent notifications specifically here: https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/pushing_background_updates_to_your_app