iOS background fetch keeps launching the app

291 views Asked by At

I'm working on an iOS application which had Background Fetch enabled via the Info.plist for around a year. There were multiple versions released with background fetch enabled, but then a few weeks ago the feature that necessitated background fetch was removed. The UIBackgroundModes key was removed completely from the Info.plist, and the app was released to the App Store. Surprisingly though, telemetry indicated that the application was still being launched in the background periodically! This is a snippet from the actual app delegate source code:

- (void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
    // NB: this callback should NEVER happen! But if it happens, we want to know about it.
    ... send telemetry log here ...
    completionHandler(UIBackgroundFetchResultNoData);
}

Has anybody experienced anything similar? According to the documentation, it should be impossible for the app to be launched if the UIBackgroundModes dictionary don't contain the right values. In this case, there's no background mode turned on at all, yet the app is periodically launched in the background to perform the fetch...

Telemetry data indicates that it happens on iOS 11 only, but that might be a coincidence because only a small fraction of the installed base is on iOS 9/10.

BTW a source level assistance request was sent to Apple with this issue, but they haven't replied yet; but maybe developers of other apps have encountered this issue before.

0

There are 0 answers