I have a UIView with 2 views inside it, one is an about us page, the other is a twitter stream/page controlled via a uisegmentation.
The twitter feed runs on didFinishLaunchingWithOptions and runs in the background.
On the twitter page itself I have a reload button which launches the same process, again performing in the background.
I am stuck because the table view never updates, even with
[self.tableView reloadData];
straight after the performInSelector.
Thus I am wanting to perform an update of the table’s data once:
[self performSelectorInBackground:@selector(reloadTwitter:) withObject:nil];
is finished.
How do I do such a task?
The first answer would probably work, but you may not be interested in using GCD and blocks. Overall the real problem is most likely that you should not be attempting to update any user interface elements in a background thread – you must do it from the main thread.
So your best option is to probably add another line within the method that is refreshing the twitter feed:
Apple has documentation on this here:
http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/Multithreading/AboutThreads/AboutThreads.html#//apple_ref/doc/uid/10000057i-CH6-SW2
Check the section labeled “Threads and Your User Interface”.