I want to do NSURLConnection
in background mode,because it response is having much data.Forums are telling to use Apple's finite length coding to use in didEnterBackground
.
but I want to avoid it.instead of it I use following code through NSOperation
with NSInvocation
as, but it is not working.connectToServer
is having NSURLConnection
operation.any help please?didReceiveData
,didReceiveResponse
delegate methods are not called?
NSOperationQueue *queue = [NSOperationQueue new];
NSInvocationOperation *operation = [[NSInvocationOperation alloc] initWithTarget:self
selector:@selector(connectToServer)
object:nil];
[queue addOperation:operation];
[operation release];
[queue autorelease];
-(void)connectToServer
{
NSURL *url = [NSURL URLWithString:@"http://www.google.com"];
NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url];
NSURLConnection *theConnection = [[[NSURLConnection alloc] initWithRequest:theRequest delegate:self] autorelease];
if( theConnection )
{
webData = [[NSMutableData data] retain];
}
else
{
NSLog(@"theConnection is NULL");
}
}