Background fetch is launched by the OS based on the value set in the setMinimumBackgroundFetchInterval: method. What you see is similar to what the OS does with your application if the background fetch takes too much time.
You are assigned a time (30 seconds) to complete your work. If you are not done, the OS kills your application with the above exception. Read more about how to extend the required time here .
Basically, you need to ask for more time to complete the background task as follows:
- (void)applicationDidEnterBackground:(UIApplication *)application { bgTask = [application beginBackgroundTaskWithName:@"MyTask" expirationHandler:^{
source share