Hey guys,
I was trying to implement multitasking in my app and I read the documentation on in, but I don't understand something. In the docs
Loading
They use the code
Code:
- (void)applicationDidEnterBackground:(UIApplication *)application
{
UIApplication* app = [UIApplication sharedApplication];
bgTask = [app beginBackgroundTaskWithExpirationHandler:^{
[app endBackgroundTask:bgTask];
bgTask = UIBackgroundTaskInvalid;
}];
// Start the long-running task and return immediately.
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
// Do the work associated with the task.
[app endBackgroundTask:bgTask];
bgTask = UIBackgroundTaskInvalid;
});
}
I do not understand what bgTask is. The docs said
Code:
The bgTask variable is a member variable of the class that stores a pointer to the current background task identifier.
But I don't really know what a background task identifier is. Could someone give me an example of one or explain it please?
Thanks