2

这是我从 url 获取图像的代码,但没有调用委托方法。为什么?

NSString *urlLink = [NSString stringWithString:appRecord.imageURLString];   
self.urlString=urlLink;
NSURL *url=[NSURL URLWithString:urlLink];
NSMutableURLRequest *request=[[NSMutableURLRequest alloc] initWithURL:url];
NSURLConnection *conn=[[NSURLConnection alloc] initWithRequest:request delegate:self];
self.imageConnection=conn;
[conn release];
4

1 回答 1

0

试试这个来检查连接是否为零

 xmlConnection = [[NSURLConnection alloc] 
                 initWithRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@", URL]]] delegate:self];
if (xmlConnection == nil){
    NSLog(@"Connection Error");
}
else{

    responseData = [[NSMutableData alloc] retain];

}
于 2012-05-16T14:24:42.900 回答