user3251 user3251 - 3 years ago 199
iOS Question

iOS background fetch custom interval

I read all Apple documentation about background fetch and currently I'm using it like this:

[[UIApplication sharedApplication] setMinimumBackgroundFetchInterval:minimumBackgroundFetchInterval];

I let OS to decide when to perform background fetch, but if I set it like this:

[[UIApplication sharedApplication] setMinimumBackgroundFetchInterval:21600];

Does that mean that fetch will happen every 6h?

Answer Source

No, it means that you are suggesting to iOS that at least six hours should elapse before a background fetch is performed, but the documentation for this property states -

The minimum number of seconds that must elapse before another background fetch can be initiated. This value is advisory only and does not indicate the exact amount of time expected between fetch operations.

So, it could be more than six hours before a background fetch is performed but probably won't be any less. iOS also takes note of the value you return via the completion handler indicating whether there was new data or not to try and determine the times of the day when there is likely to be new data for your app.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download