didReceiveRemoteNotification not running background

I'm trying to log when a user gets a silent notification using didReceiveRemoteNotification. Here is my code right now:

func application(
        _ application: UIApplication,
        didReceiveRemoteNotification userInfo: [AnyHashable : Any],
        fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void
    ) {
        print("Log here")

        application.applicationIconBadgeNumber = 0
        completionHandler(.noData)
    }
Here is the payload.apns file:

 "aps" : {
    "content-available" : 1,

    },
    "acme1" : "bar",
    "acme2" : 42

If i open Console.app application I can see that the (simulator in this case) wakes up in the background when I drag and drop the payload but it never runs the didReceiveRemoteNotification function.

The app is written in SwiftUI and has a seperate AppDelegate file. The app is also using Firebase Analytics and I have tried to set the FirebaseAppDelegateProxyEnabled to "NO" (false).

Am I doing something wrong?

Note: The function gets called when the app is in the foreground and I drag and drop a normal alert notification (not silent).

Replies

Hi Buddy, Im having same issue, did you get any solution ? Appreciate and thank you for your help in advance if any, thanks!! https://forums.developer.apple.com/forums/thread/745188