Вы должны просто использовать эти методы в классе, который запускает nsurl-соединение:
#pragma mark -
#pragma mark Download support (NSURLConnectionDelegate)
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
[self.activeDownload appendData:data];
}
- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error // Never called (deprecated method not used with IOS version >> 4.3 ???)
{
// Clear the activeDownload property to allow later attempts
self.activeDownload = nil;
// Release the connection now that it's finished
self.imageConnection = nil;
}
- (void)connectionDidFinishLoading:(NSURLConnection *)connection{
UIImage *image = [[UIImage alloc] initWithData:self.activeDownload];
self.activeDownload = nil;
// Release the connection now that it's finished
self.imageConnection = nil;
}
, где imageConnection - свойство типа NSURLConnection:
NSURLConnection *imageConnection
, а activeDownload -NSMutableData:
NSMutableData *activeDownload