A weird problem. I wanna load an image from web, so i use NSURLConnection to do it. Everything is ok when i do testing my code on ios4.3. But when i'm launch my app on ios5.0, i found the connection:didreceiveData haven't been called whatever what i did. otherelse functions is called normally, just like connectionDidFinishLoading in ios4.3 and connectionDidFinishDownloading in ios5.0. so u guys, who can help me, thanks advanced!
-(void)load
{
if(isDownloading){
return;
}
if(conn != nil){
[conn release];
}
if(data != nil){
[data release];
data = nil;
}
[self isDownloading:YES];
ImageDownloadData* imageDownloadData = [imageList objectAtIndex:count];
NSURL* url = [imageDownloadData url];
NSURLRequest* request = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0];
conn = [[NSURLConnection alloc] initWithRequest:request delegate:self];
if(conn){
[conn start];
}
}
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)rd
{
NSLog(@"data");
if(!data){
data = [[NSMutableData alloc] initWithData:rd];
return;
}
[data appendData:rd];
}