views:

76

answers:

2

Hi , I am creating a news aggregator application that fetches a xml feed every 4 minutes. After the xml is loaded, I clear everything by deleting all the objects in the database, then save the new objects back into the database. I then call [self.tableViewSection reloadData]; to reload the tableView. Thats when I get a problem. As soon as the code gets to a section where i access the new [[managedObject valueForKey:@"event_text"] description] content it fails with a :

* Terminating app due to uncaught exception 'NSObjectInaccessibleException', reason: 'CoreData could not fulfill a fault for '0x4b3f6a0 ''

Now from the flow I described on top, it seems odd to me that the tableView is populated properly the next time i launch the application, with the "new" data I fetched in the previous session. So its not that data thats corrupt , but seems to me something goes wrong when I refetch the managedObject after saving new data.

Also keep in mind thats this app runs fine on the iPhone, its the iPad thats is giving me this problem.

A: 

I have found the solution, you need to tell the fetchedController to do a performFetch again before reloading the new data.

-(void)reloadFetchController
{
    NSError *error = nil;
    if (![[self fetchedResultsController] performFetch:&error]) 
    {
        NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
        abort();
    }
}

Anyone know why this is different between iPhone OS3.0 & 3.2

A: 

Can you elaborate on the delete processing?

If the delete is on the same context as the fetched results controller is attached, it sounds like you're not saving the context after the deletion. If you did, changes would be processed and the fetched results controller would update, reflecting the deletion via delegate methods.

ohhorob