small medium large xlarge

28 Nov 2012, 19:25
Lorenzo Boaro (4 posts)

Dear Marcus,

first of all, your book is simply amazing.

Then, I need some help with NSFetchedResultsController. I’m developing a quite complex app and I’m taking advantage of NSFetchedResultsController to retrieve data from a store and display them in a table. Displayed managed objects have a syncStatus boolean variable to verify if they have been synced with an external service or not. syncStatus variable is not displayed in a cell, different info are displayed (e.g. text values). In other words, syncStatus is not fired as fault.

In the table, by means of NSFetchedResultsController, I display the only elements that are not synced (the bool value is set to NO).

The user can select the elements she/he wants to sync and a background thread sends the selected elements to the service and, for those, it also changes the syncStatus variable to YES.

When the operation is finished, since I set the NSFecthedResultsControllerDelegate and I register for NSManagedObjectContextDidSaveNotification (I also merge the changes through the notification and I’m able to see the notification contains objects with the correct change), I expect the table is updated (the objects with syncStatus set to YES would be not displayed). It seems not working. Delegate does not fire. Instead, if I change that value in the main thread the delegate fires correctly.

Does the missing update is due to the fact isSyncStatus is not loaded on memory but it remains a fault? Does this due to memory-only tracking (the delegate is non-nil and the file cache name is set to nil.)?

Thanks in advance, Lorenzo

You must be logged in to comment