I call one api in applicationDidEnterBackground
, but applicationDidEnterBackground
method returns after 5 seconds so how could I increase timer or after api finish then only applicationDidEnterBackground
will return all of us suggest use beginBackgroundTaskWithExpirationHandler
But I don't know how to use it can anyone guide me?
Here is my code
- (void)applicationDidEnterBackground:(UIApplication *)application
{
NSString *link=[NSString stringWithFormat:@"http://www.askpundit.com/dev/js_chat/getNewRequest.php?updateStatus=%@&clientid=%@",UpdateStatus,[self getSetting:@"Clientid"]];
NSURLRequest *request=[[NSURLRequest alloc]initWithURL:[NSURL URLWithString:link]];
NSURLConnection *connaction=[[NSURLConnection alloc] initWithRequest:request delegate:self];
if (connaction)
{
responsedata=[NSMutableData data];
NSLog( @"Data Saved");
}
}
Can any one guide me how return applicationDidEnterBackground
after my call finish.