Upvote:3

-[UIApplication beginBackgroundTaskWithName:expirationHandler:]

More Answer related to the Same Query

Upvote:0

[backgroundSession uploadTaskWithRequest:request fromData:data completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {
    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response;
    if (httpResponse.statusCode == 200) {
        NSMutableURLRequest *postRequest = [NSMutableURLRequest requestForURL:[NSURL URLWithString:@"http://somethingorother.com/"]];
        request.HTTPMethod = @"POST";
        .
        .
        .
        NSURLResponse *postResponse;
        NSError *postError;
        NSData *postResponseData = [NSURLConnection sendSynchronousRequest:postRequest returningResponse:&postResponse error:&postError]; 
        // Check postResponse and postError to ensure that the POST succeeded
    }
}];

Credit Goes to: stackoverflow.com

Related question with same questions but different answers