Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are silent remote push notifications deprecated in iOS 11?

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.

like image 634
Mercutio Avatar asked Feb 12 '18 23:02

Mercutio


People also ask

Will iOS awake my app when I receive silent push notification?

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.

Why push notification is not working for iOS?

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.

How do I turn on silent notifications in iOS?

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.

What is silent push notification in iOS?

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.


1 Answers

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
like image 90
Antenehs Avatar answered Sep 20 '22 16:09

Antenehs