I have a simple app that downloads search results in XML when the user types in a UISearchBar
. The download+parsing is threaded and once done it fires an NSNo
My problem was that I was posting a NSNotification from a background thread. To avoid this, simply wrap your postNotificationMethod in a dispatch_async method like this:
dispatch_async(dispatch_get_main_queue(), ^{
[[NSNotificationCenter defaultCenter] postNotificationName:@"FinishedDownloading" object:result];
});
When this notification will be received, the tableView.reloadData
will be called on the main thread.