I'm developing an iPhone application where the data comes from a webservice that returns a json file. I'm using the following command in the viewDidLoad of the UITableViewController where I want to bind the data:
responseData = [[NSMutableData data] retain];
NSURLRequest *request = [NSURLRequest requestWithURL:
[NSURL URLWithString:@"webservice url"]];
[[NSURLConnection alloc] initWithRequest:request delegate:self];
and then I get the data from the json result into a NSDictionary in the connectionDidFinishedLodading Delegate.
The problem is that the numberOfRowsInSection delegate from UITableView executes before the connection finishes downloading data, which makes my table view with zero rows and doesn't show anything.
What am I doing wrong? Did I misunderstand the concept of the viewDidLoad and should be loading this data elsewhere?