4

I've already read Apple's documentation on background modes, but I still have some questions.

Please correct me if I'm wrong:

To enable remote notifications: I only need to do:enter image description here

To enable silent notifications: I need to enable Push notifications like above and also enable remote notifications enter image description here

My questions are:

  1. Are the above statements correct?
  2. For handling silent notifications, do I ever need to enable background fetch from Xcode Capabilities? Or that has nothing to do with silent notifications and it's only to be used when you want to trigger an interval-based download that isn't triggered from server.
mfaani
  • 33,269
  • 19
  • 164
  • 293

1 Answers1

4

Answer for 1st question : Yes Correct, You have to enable both options, Background mode - Remote notification and push notifications if you need to listen silent push notification also. Else enable only push notification

Answer for 2nd question : Background fetch is not related with push/silent notification. Your app will listen the silent push notification only if you enable the background mode remote notification. Otherwise OS won't allow your app to listen silent push notification.

mfaani
  • 33,269
  • 19
  • 164
  • 293
Subramanian P
  • 4,365
  • 2
  • 21
  • 25
  • and so it has nothing to do with `background fetch`? – mfaani Jun 15 '17 at 17:09
  • 1
    Background fetch - Applications with the "fetch" background mode may be given opportunities to fetch updated content in the background or when it is convenient for the system. Its nothing related with push notification – Subramanian P Jun 15 '17 at 17:14
  • func application(_ application: UIApplication, performFetchWithCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Swift.Void) { }. This method will be called in these situations. You should call the fetchCompletionHandler as soon as you're finished performing that operation, so the system can accurately estimate its power and data cost. – Subramanian P Jun 15 '17 at 17:14
  • have you answered my comment above? The answer is yes or no...I'm not able to understand what's yours – mfaani Jun 15 '17 at 17:19
  • 1
    Background fetch is not related with push notification – Subramanian P Jun 15 '17 at 17:19
  • First you should know what is "background fetch" then you will come to know weather it is required or not. – Subramanian P Jun 15 '17 at 17:21