There are many structures to download data from server. like
- ViewDidLoad Make NSURLConnection, call its delegate and when connection ends, make parser and parser data and then save to DB. (EVERYTHING IN THE SAME CLASS)
Another way is
- Make a separate class, that will manage all NSURLConnections + NSXMLParser, and just make object of that class in ViewDidLoad or any other method of ViewController Class.
Another way is
Make a file to set connection, and make another file to manage parser
ViewController =====================>> URLConnection Delegate of URLConnectionfile =====================>> ViewController
then, in this delegate, NSData which is downloaded from server is further send to Parser class
ViewController =======================>> ParserClass
Delegate of Parser gives Array to ================= ViewController
then display that Array
Another way is to use thread
Call such methods in
[self performSelectorInBackground:@selector(doSomething) withObject:nil];
then in doSomething , call your connection file
Can anyone define the best way to download and save in a very organised and proper way, so that it becomes easy to manage and no hang of View occur.