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 All (Single section with alphabetical order), Region wise (Each region as section) and Type wise (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.
1 ) For any update (eg: set a location as favorite) gives NSFetchedResultsChangeDelete instead of NSFetchedResultsChangeUpdate.
2) tableview sorting for Types 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.]
Not quite sure but, CoreData has some set of flaws when it comes to notification of changes (which is a great exclusive feature) but I found that NSFetchedResultsChangeDelete doesn't necessarily mean that an object has been deleted from the database, it means that the object is no longer available on the fetched objects either because it was deleted or it no longer fits the current predicate (conditions). You should check into that.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.