Note that there are some explanatory texts on larger screens.

plurals
  1. POMultiple NSFetchedResultController for a single UITable and CoreData Entity design
    text
    copied!<p>I am developing an iPad application which stores details about locations which shows in a tableview. User would be able to sort the locations by <strong>All</strong>(Single section with alphabetical order), <strong>Region wise</strong>(Each region as section) and <strong>Type wise</strong>(Each type as section). I am using separate NSFetchedResultController for each as the 'sectionNameKeyPath' has to be given while initialization. I am having 2 problems now. Spent more than 1 week searching but the solutions I found creating more related issues.</p> <p>1 ) For any update (e.g: set a location as favorite) gives NSFetchedResultsChangeDelete instead of NSFetchedResultsChangeUpdate.</p> <ul> <li>Many forum says its a known bug if we use multiple fetchedResultController</li> <li>Only way I could avoid is not using delegate methods and to fetch again for each change. So missing the tableview animation solely.</li> <li>Not all update gives delegate call back. Am I going in right way or is there a better way that I can use single FetchedResultController?</li> </ul> <p>2) tableview sorting for <strong>Types</strong> cannot use FetchedResultController efficiently with current Entity design. Current design use entities Location, Types and Region. Location to Region is a one-to-many relation. But Location-to-Types is a many-to-many relation in both direction. [I tried to upload entity design image but my reputation does not allows that.]</p> <ul> <li><strong>Types</strong> to <strong>Location</strong> relation is many-to-many in both direction. So cannot give sectionNameKeyPath because types is a Set in <strong>Location</strong> entity. So am fetching from <strong>Types</strong> entity and getting location array(set) from that.</li> <li>So numberOfRows can be calculated from set.But its not ordered. so I am sorting it using comparator. Am not sure this is the right way, so am asking all of you to give your valuable suggestions about this Entity design.</li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload