Question

Overview:

Stanford iOS tutorials contains an implementation (header + implementation file) to help use the table view while using core data.

Link - http://www.stanford.edu/class/cs193p/cgi-bin/drupal/downloads-2011-fall

File Name - CoreDataTableViewController.zip
CoreDataTableViewController.h contains the following text:

// Remember that once you create an NSFetchedResultsController, you CANNOT modify its @propertys. If you want new fetch parameters (predicate, sorting, etc.), create a NEW NSFetchedResultsController and set this class's fetchedResultsController @property again.

Question

It sounds a bit strange, because in docs they mention situation when you change properties, and recommend some thing in this case... Look like some mistake, or I miss something. If i just change predicate and fetch again, everything works...

Was it helpful?

Solution

It depends if you are using a cache or not. As it says in the documentation you link to:

If you are using a cache, you must call deleteCacheWithName: before changing any of the fetch request, its predicate, or its sort descriptors. You must not reuse the same fetched results controller for multiple queries unless you set the cacheName to nil.

If you are changing these properties, then it is probably simpler (this is a beginner's course, and the creation of the fetched results controller is done outside of this sample code) to just tell you to create a new fetched results controller than to go into an explanation of caching, and clearing a cache, and so on.

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