I have tried to implement background fetch, to hopefully can wake the app from time to time.
I have done these:
func application(_ application
Background Fetch is automatically initiated by the system at appropriate intervals.
A very important and cool feature of the Background Fetch is its ability to learn the times that should allow an app to be launched to the background and get updated. Let’s suppose for example that a user uses a news app every morning about 8:30 am (read some news along with some hot coffee). After a few times of usage, the system learns that it’s quite possible that the next time the app will run will be around the same time, so it takes care to let it go live and get updated before the usual launch time (it could be around 8:00 am). That way, when the user opens the app the new and refreshed content is there awaiting for him, and not the opposite! This feature is called usage prediction.
For testing whether the code you wrote works properly or not, you can refer to Raywenderlich's tutorial on Background Fetch.
Tutorial: https://www.raywenderlich.com/143128/background-modes-tutorial-getting-started (Search for: Testing Background Fetch)