I know its stupid to ask but i dont know where i am wrong. I am new to NSURLConnections. I have to download a file using NSURLConnection. here is my code:
NSURL *url = [NSURL URLWithString:@"http://www.comicbookresources.com/feed.php?feed=previews"];
NSURLRequest *request = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:30];
NSURLConnection *connection = [[NSURLConnection alloc]initWithRequest:request delegate:self startImmediately:YES ];
[self.data appendData:self.data];
NSString *filePath = [NSString stringWithFormat:@"%u/%@", NSDocumentDirectory,@"usman.pdf"];
[self.data writeToFile:filePath atomically:YES];
it looks ridiculous but still i am asking
EDIT: I am sorry. I forgot to add word: asynchronous connection