views:

76

answers:

2

Hi,

So I've transferred the core data code from Apple's sample Core Data / RSS parser application, TopSongs, into my own application. It loads fine, (i.e. no errors or warnings) and the first time you open the app all that happens is the UIActivityIndicator spins and then stops. No data displays in the UITableView.

You then have to close the app, and then re-open it (not re-build it) which then finally displays the data in the table. Why is it doing this? Is there a way to stop it happening?

Thanks.

A: 

What's happening is that your app is parsing RSS data and storing whatever is parsed into Core Data storage. However, your views aren't updated when Core Data is updated. It's similar to loading a web page and then having something else change the HTML for the page without having the browser reload; that's what's happening with your UITableView.

It seems like what you need is to refresh the data source for the UITableView when the parser reaches the end of the RSS feed.

Giao
OK I'll go back and look over the code again, double-check I got it right. Thanks.
Graeme
+1  A: 

I suspect the sample code is using a NSFetchResultsController. If that is the case then you need to make sure you have set the delegate and that the delegate responds to the methods that the NSFetchResultsController calls so that it can notify you when the data changes.

Marcus S. Zarra