我正在尝试使用 NSURLConnection 通过 HTTP 获取图像。我在后台执行选择器
[self performSelectorInBackground:@selector(loadingDaemon) withObject:nil];
我在哪里做这个
NSString *fullImageURL = [NSString stringWithFormat:@"http://%@/%@", baseURL, currentlyLoadingImage];
NSURL *imgURL = [NSURL URLWithString:fullImageURL];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:imgURL];
request.timeoutInterval = 10;
NSURLConnection *newConnection = [NSURLConnection connectionWithRequest:request delegate:self];
我将 NSURLConnection 的委托设置为self并实现方法
connection:didReceiveResponse:
connection:didReceiveData:
connection:didFailWithError:
connectionDidFinishLoading:
此外,我记录每个方法调用和条件分支。但是上面的 4 个函数永远不会被调用。请你能解释一下为什么吗?