json webservice and uitableview

511 Views Asked by At

I have JSON web-service and my task is to parse the web service and store the data into UITableview.

I am parsing the web service using NSURLConnection methods.

After parsing the web-service i got the response what I wanted .

But the issue is that my UIViewController is calling UITableView Delegate and Datasource methods first and then it calls web-service so my UITableView doesn't get any response.

Even though I call the web-service first it calls all the UITableView Delegate and Datasource methods first and then web-service so my table view doesn't get any response.

After calling the web-service i get perfect response.

So if somebody knows any solution please help me. Thank you.

3

There are 3 best solutions below

3
On BEST ANSWER

The other answers in this thread should solve your problem.

However, if you find that [self.tableView reloadData] isn't refreshing the data in your UITableView, check out my suggestion on this thread:

Fails to call delegate/datasource methods in UITableView implementation

I'm not sure if this is a quirk with iOS 8, but I've had a few occassions where just setting the table's dataSource and delegate in the code hasn't been enough.

0
On

After you get your response and populate dataSource just call

[self.tableView reloadData];
0
On

Just set the data-source and delegate of table view in the delegate of the web-service delegate or where you get the response and reload the table view.