In my app, I am uploading images to server from iPhone. While sync if user press home button, App will close.
I want app must be running in background till sync finish.
My question is: How can I add currently running task with "beginBackgroundTaskWithExpirationHandler
"?
Please share your ideas.
I used below code for background task handler:
__block UIBackgroundTaskIdentifier backgroundTaskIdentifier = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{
NSLog(@"Background Time:%f",[[UIApplication sharedApplication] backgroundTimeRemaining]);
[[UIApplication sharedApplication] endBackgroundTask:backgroundTaskIdentifier];
backgroundTaskIdentifier = UIBackgroundTaskInvalid;
}];