Sérgio Lopes Sakabatō, the reversed blog!

UITableView ignoring reloadData message?04 Aug 2013

Just a small note to myself :), and anyone that happens to stumble on this looking for the answer…

UITableView is use a lot in iOS applications, it is one very useful component even if the defaults offer, what at first glance looks like, a very limited list of items. Usually you have your own delegate and dataSource to fill in the table, and periodically call the reloadData method, at least, if your data comes from some WebServer, API or any external source.

If this is you and you’re having issues with your table not updating as soon as the data updates and you call reloadData, if you’ve confirmed that the table is not nil at the time you’re calling the reload method, are you calling the reload as part of a different thread? Maybe inside some Grand Central Dispatch call? If so, check that you’re calling the reloadData method inside the main thread, if you’re not that is the reason why your table is ignoring you reload calls.

Now, I know this is something basic, but I’ve just spend the good part of an hour tracking this stupid mistake :)

So, to summarize, the symptoms are: UITableView that does not update by code, but does so if you scroll the table, neither the table pointer (IBOutlet) nor the data structure you’re using to fill the table is nil.

The most likely cause is that you’re updating the table on a thread that is not the main thread, all UI calls need to be done inside the main thread or the UI won’t updated.