'Can we force BGAppRefreshTask to run on receipt of a silent notification in the background

Id like to know how to get iOS to fetch data from a server on receipt of a silent notification while the app is in the background.

For background, I'd like my app to fetch fresh data from my server while the app is in the background.

I first looked into BGAppRefreshTask but it seems very unreliable. From what I can gather it only runs when the system 'thinks' it should so this wont really work for my needs.

In fact, I'm positive that I have implemented BGAppRefreshTask correctly but I have never seen any of the tasks actually execute.

What I would like to do is trigger the fetching of data while my app is in the background by responding to a silent notification.

Can this be achieved somehow with BGAppRefreshTask by responding to a silent notification?

If this is not possible how can I achieve my goal of reliably and predictably fetching data while the app is in the background?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source