I am working on RSS reader code where articles get downloaded and are viewable offline. The problem is only after all articles are downlaoded the tableview containing headlines gets updated. Core data is used. So everytime NSobjectcontext is saved , [self tableview updatebegins ] is called.The table is getting updated via fetchcontroller core data.
I tried saving NSobjectcontext everytime an article is saved but that is not updating the tableview. I want a mechanism similar to instapaper tableview where articles get saved and tableview gets updated immediately. Please help if you know the solution. Thanks in advance.
Adding code for better understanding
AppDelegate.m contains following code
- (void)feedSuccess:(ZSURLConnectionDelegate*)delegate
NSManagedObjectContext *moc = [self managedObjectContext];
CXMLElement *root = [document rootElement];
CXMLElement *channel = [[root elementsForName:@"channel"] lastObject];
NSFetchRequest *request = [[NSFetchRequest alloc] init];
[request setEntity:[NSEntityDescription entityForName:@"FeedItem" inManagedObjectContext:moc]];
for (CXMLElement *item in [channel elementsForName:@"item"])
{
// push element in core data and then save context
//Save context
[moc save:&error];
ZAssert(error == nil, @"Error saving context: %@", [error localizedDescription]);
}
this triggers the table change code in RootviewController.m
- (void)controllerWillChangeContent:(NSFetchedResultsController*)controller
{
[[self tableView] beginUpdates];
}