我有标记的 NSURLConnection 子类,需要从多个 URL-s 获取图像数据......这个想法对我来说很清楚,但我无法正确启动连接,因此数据会附加到它的位置...... .在这里我有:
- (IBAction)sophisticatedDownload {
connectionDict = [[NSMutableDictionary dictionaryWithCapacity:news.count] retain];
for (int i =0; i<news.count; i++)
{
//init the tagged connection
if (theConnection) {
self.imageData = [NSMutableData data];
[connectionDict setObject: imageData forKey: theConnection.connID];
} else {
NSLog(@"Connection failed");
}
}
}
- (void)connection :(tagConnection *)connection didReceiveData:(NSData *)data {
[[connectionDict objectForKey:connection.connID] appendData:data];
}
- (void)connectionDidFinishLoading:(tagConnection *)connection {
NSLog(connection.connID);
什么应该