Hi I am trying to create a NSOperaion Queue to download a bunch of PDF files. But it doesnt work. The delegate methods dont get called for NSURLConnection since i put them in NSOperation queue.... any alternatives or solution???
- (void) loadData {
NSOperationQueue *queue = [NSOperationQueue new];
NSInvocationOperation *operation;
for(int i=0;i<[self.pdfArray count];i++){
NSString *url = [NSString stringWithFormat:@"http://www.somelink.com/%@.pdf",[self.pdfArray objectAtIndex:i]];
operation = [[NSInvocationOperation alloc] initWithTarget:self
selector:@selector(loadDataWithOperation:)
object:url];
[queue addOperation:operation];
[operation release];
}
}
- (void) loadDataWithOperation:(NSString *) url{
// Create the request.
NSURLRequest *theRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:url]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:60.0];
NSURLConnection *theDownload = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self startImmediately:YES];
}