Currently I'm able to receive silent push using app delegate's didReceiveRemoteNotification
method.
That method is deprecated and according to this we're supposed to be switching to UNUserNotificationCenter
's willPresent
method, but I can't seem to get it to work for silent push. Since there's no notification to present in a silent push, it would be counterintuitive if that did work, to say the least.
Have read registering for push Xcode 8, CKSub w/out notification, and plenty others but everything keeps coming back to the deprecated method.
Is there an alternative we're supposed to be using for silent push (which is not a user facing notification, but in this case it's a CKQuerySubscription
report that triggers background activity)? Or should willPresent
work for silent pushes (in which case I've missed a part of the config...)?
Thanks in advance.
Silent remote notifications can wake your app from a “Suspended” or “Not Running” state to update content or run certain tasks without notifying your users.
You can fix an iPhone that's not getting notifications by restarting it or making sure notifications are turned on. You should also make sure your iPhone is connected to the internet so apps can receive notifications. If all else fails, you should try resetting the iPhone — just make sure to back it up first.
Go to Settings > Focus. Tap Do Not Disturb. You can select allowed or silenced notifications from people and apps, connect your Lock Screen or Home Screen, have this Focus turn on automatically, and add Focus filters.
Silent push notifications are simply notifications that mobile app users receive without any pings, alerts, or interruptions to the user. They arrive on the mobile device and sit in the notification tray until read or dismissed.
Use this
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler
or for Swift
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
}
The deprecated one is
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With