views:

380

answers:

1

Hi All,

I need some help regarding the NSURLConnectionDelegate method.

- (void)startDownload {
NSString *URLString = [NSString stringWithFormat:appRecord.imageURLString]; 
NSURL *url = [NSURL URLWithString:URLString];   
NSURLRequest *request = [NSURLRequest requestWithURL:url];

imageConnection = [[NSURLConnection alloc] initWithRequest:request delegate:self];  
if(imageConnection) {
    activeDownload = [NSMutableData data];
}

}

I am using this method to initiate the NSURLConnection, but the

- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data

is not calling.. Need Help

Thanks in advance, Shibin

+2  A: 

No single answer but: 1) Put some NSLogs in to display the URL and then validate that it is generated correctly and does return data

2) Check that you have properly declared that you conform to the NSURLConnectionDelegate protocol in the .h

3) Are you threading or messing with the runloops ? " Messages to the delegate will be sent on the thread that calls this method. By default, for the connection to work correctly the calling thread’s run loop must be operating in the default run loop mode."

Andiih
Thanks a Lot Andiih, but still its not working. i am getting the same output. I tried with NSlog and NSURLConnectionDelegate protocol is declared in .h file. I cant understand why its happening like this.
Shibin Moideen