Downloading and parsing an array of NSURLConnections
I have an NSArray of NSURLConnections with requests that return xml. What's the best way to systematically, for each of NSURLConnection:
- Download the data and store it in NSMutableData
- Parse it using NSXMLParser (or any other way if you guys think it's better).
I am not asking how to use NSURLConnection or how to parse xml, but merely looking for th开发者_如何学编程e best way to approach this problem as there's alot of elements in that array that need to be download and then parsed and then saved in another mutable array and then later on saved to disk.
Thanks.
If you are looking for the best approach, look at ASIHTTPRequest as far as network access is concerned.
For your case, ASIHTTPRequest
offers operation queues (ASINetworkQueue
), makes very easy to collect the data (easier than NSURLConnection
), and offers also a very good cache.
As to parsing the XML, read this article: How To Choose The Best XML Parser for Your iPhone Project
Have a look at NSOperation and NSOperationQueue and this tutorial.
精彩评论