In iOS 10, I see that there are two functions for handling local push notifications:
func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void)
and
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void)
The first is invoked when a push notification happens when the app is in the foreground. The second occurs when a push notification happens when the app is in the background AND the user clicks on the notification.
My question is, is there a way to handle a local push notification when the app is in the background WITHOUT the user having to click on it? Ideally, I'd like all of my push notifications, whether while the app is in the background or foreground, to trigger a CloudKit update. Is this even possible?
Thanks!
didReceiveRemoteNotification:completionHandler
App delegate method – Paulw11add
operation to the database. – mlecoz