In my application , After receving push notification I need to download data from server and saved into database when application is in back ground. here is my code
NSOperationQueue *myQueue = [[NSOperationQueue alloc] init];
NSURLRequest *request = [NSURLRequest requestWithURL:Url];
[NSURLConnection sendAsynchronousRequest:request
queue:myQueue
completionHandler:^(NSURLResponse *response,
NSData *data, NSError *error){
[self saveDataIntoDB:data];
}];
This code is excuting when application is in foreground only. Thanks.