Question

I once again come about my RSS Reader iApp which, at the moment, is designed the following way:

  • Data model: Category -> Feed -> Post
  • Master View: Feeds grouped by categories
  • Detail View: Posts for a given Feed

All of the views and the app delegate only interact with the same _mainMOC (ManagedObjectContext).

Each of the created NSOperations will use its own _localMOC which is connnected to the same NSPersistentStoreCoordinator.

When the App starts, it creates for each of the Feeds a fetchOp NSOperation which it adds to an NSOperationQueue. This should ensure the RSS Feeds will be individually downloaded, parsed, then their contents inserted Post by Post in CoreData.

The AppDelegate observes the NSManagedObjectContextDidSaveNotifications and merges the modifications if the notification it receives is not _mainMOC. It then sends a specific NSNotification to notify the each of the views that a reloadData is required.

Questions:

  • Do I still need to enclose my _mainMOC save: operations in performBlock blocks?
  • Should each of my views only use a _localMOC instead of the _mainMOC?
  • Isn't it redundant to have each view's local NSFetchedResultsController re-perform a fetch before a reloadData?
  • Should I make any non-read-only Core-Data Operation a queued NSOperation, even at the view level?
  • How could I make all of this smoother (it still isn't and I still have a few horrendous bugs so redesign is a possibility)...

Thanks for your help.

Was it helpful?

Solution

1) & 2) It doesn't appear these are absolutely required: we are in the main thread, after all.

3) This couldn't hurt: especially if the NSFecthedResultsController uses a variable NSPredicate (see here).

4) I am going to do it anyway as it doesn't hurt.

5) Keep in touch...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top