Initial selection of background image ios8 GET

I am trying to periodically (once a day) make a GET request in the background and schedule a notification based on that data. According to the docs, this should be possible, but I can't seem to find a single example of code that anyone actually does this. Can anyone point me towards some quick code that demonstrates this?

Docs about fetching small amounts of content opportunistically

Relevant paragraph from docs: Applications that need to periodically check for new content may ask the system to wake them up so that they can initiate a fetch operation for that content. To support this mode, enable the Background Fetch option from the Background Modes section of the Features tab in your Xcode project. (You can also enable this support by including the UIBackgroundModes key with the fetch value in your application's Info.plist file.) Enabling this mode does not guarantee that the system will present your application at any time to perform background settings. The system must balance your applications to receive content with the needs of other applications and the system itself. After evaluating this information, the system gives time to applications when there are good opportunities to do so.

When a good opportunity arises, the system wakes up or runs your application in the background and calls the application's delegates: executeFetchWithCompletionHandler: method. Use this method to check for new content and initiate a download operation if the content is available. Once you've finished loading new content, you must execute the provided completion handler block, passing in a result that indicates whether the content is available. Executing this block tells the system that it can move your application back to a suspended state and evaluate its energy use. Apps that load small amounts of content quickly and accurately reflect when they have content available for download are more likely to get future runtimes than apps.who take a long time to download their content or that application content was available, but then don't download anything.


source to share

1 answer

This works great. A very reliable solution.



All Articles