I’m operating into an issue with distant push notifications on iOS.
When the app is in background or inactive, tapping a notification accurately triggers:
userNotificationCenter(_:didReceive:withCompletionHandler:)
…however when the app is killed, tapping the notification launches the app, but no delegate technique fires and my monitoring occasion by no means will get despatched.
I’m utilizing:
-
SwiftUI @ foremost App
-
@ UIApplicationDelegateAdaptor for the AppDelegate
-
UNUserNotificationCenter delegate set manually
-
FirebaseAppDelegateProxy disabled
-
No SceneDelegate
I’ve tried:
-
Checking launchOptions?[.remoteNotification] (not fired on iOS 15+)
-
Including software(_:proceed:restorationHandler:)
-
Stopping banners throughout launch (suggestion by chatGPT however made no distinction)
Foreground + background faucet dealing with works completely — solely killed → faucet → launch fails to ship the payload. hell i am unable to even see logging for that circulate.
Some code i’ve:
class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate {
func software(
_ software: UIApplication,
didFinishLaunchingWithOptions launchOptions:[UIApplication.LaunchOptionsKey : Any]?
) -> Bool {
UNUserNotificationCenter.present().delegate = self
return true
}
func userNotificationCenter(
_ heart: UNUserNotificationCenter,
didReceive response: UNNotificationResponse,
withCompletionHandler completionHandler: @escaping () -> Void
) {
handleNotificationTap(response.notification.request.content material.userInfo)
completionHandler()
}
public func handleNotificationTap(_ userInfo: [AnyHashable : Any]) {
let id = userInfo["notification_id"]
let notificationId = (id as? Int).map(String.init) ?? (id as? String)
if let finalId = notificationId {
Analytics.observe("notification_opened", parameters: ["notification_id": finalId])
} else {
Analytics.observe(
"notificationTappedWithoutID",
parameters: ["payload": userInfo]
)
}
}
As you’ll be able to see there ought to all the time be some occasion ship, however at present i obtain none. i additionally tried didReceiveRemoteNotification however that did not work both.
Any assist can be appreciated. been wanting in to this for a couple of nights now.

