In Xcode 7.0.1 the "simulate background" fetch command causes performFetchWithCompletionHandler
to be triggered twice.
Is this an Xcode debugging error, or can this happen on a device running a release build of the application.
Update
Now we have Xcode 7.1.1 and still performFetchWithCompletionHandler
is called twice. Since I am not sure if this also happens "in the wild" I am keeping a state if my fetch action is already running.
- (void)application:(UIApplication *)application performFetchWithCompletionHandler:(nonnull void (^)(UIBackgroundFetchResult))completionHandler {
if (self.performingFetch) {
return completionHandler(UIBackgroundFetchResultNoData);
}
self.performingFetch = YES;
...
self.performingFetch = NO;
}