getting a didReceiveResponse connection error

60 Views Asked by At

So my goal is to fix the didReceiveResponse method in my code and be able to print the print statement when the action is tapped on in the notification.

So I have the method in my DashboardVC file in an extension:

extension DashboardVC: UNUserNotificationCenterDelegate {
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {

    if response.actionIdentifier == "viewNewEvent" {
       print("Notification Response")
    }
    completionHandler()
}

}

I had it in the AppDelegate at first, but when you first download an app, I think it would make more sense to be prompted the notification authorization when you actually sign up/ log in like Snapchat for example. The actionIdentifier matches perfectly fine, not a problem with that, but when the notification gets sent out and I tap on the notification action, I get this in the console:

error image

and the print statement never prints. I pasted the some of the errors into google and looked up on it, but some of the cases were completely different then mine, the only term that made the most sense from researching was background tasks. This does get called when the app is in the background about to enter the foreground so it kinda does make sense for it being a background task. Now I have no idea where to begin on how to fix an issue like this and I'm hoping that maybe somebody ran into the same issue and could explain in depth how to either find a solution or a solid workaround. Thanks in advance.

0

There are 0 best solutions below