How to download 100 images at a time with gtm-http-fetcher?
I'm using gtm-http-fetcher in my application. It's easy to fetch a single resource with it. Now I need to download 100 pictures at a time. I have the URL for ea开发者_如何学编程ch image. When I get a image, I need to match it with its URL. What should I do?
UPDATE: May I put all the fetchers into an operation queue to fetch images concurrently?
The URL is available as
NSURL *url = fetcher.mutableRequest.URL;
You could set up a dictionary and map the connection object to the url
NSDictionary *dict = [NSDictionary dictionary]; //you'll need to retain this
...
[dict setObject:thisUrl forKey:thisConnection];
Then get the urls out when you need them when the connection finished loading
- (void)connectionDidFinishLoading:(NSURLConnection *)connection
...
NSURL *url = [dict objectForKey:thisConnection]
精彩评论