user2068793 user2068793 - 1 year ago 255
Objective-C Question

performFetchWithCompletionHandler never gets fired

1) My plist configuration to provide backgroundmode:


2) In
I have:

[[UIApplication sharedApplication] setMinimumBackgroundFetchInterval:1.0];

3) I declared the protocol
in the delegate.

4) I implemented the following method, but it never gets fired. (It only works if I simulate the fetch with "XCode->Debug->Simulate Background Fetch".)

-(void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler

Why? Is this a DP5 beta error? Should I radar this?

Answer Source

I'm afraid this is hard to debug on a device because you're not guaranteed it is called in the amount of time you specify.

setMinimumBackgroundFetchInterval means that it is not called in an interval which is smaller than the value you specified. But there's no setMaximumBackgroundFetchInterval. So if iOS decides to call your app just once a day or even just once a week than it won't be called more often regardless your minimumBackgroundFetchInterval. AFAIK iOS decides when to call performFetchWithCompletionHandler measured by the pattern when and how often the users start's the app.

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