Ok here goes my setup:
Object Model:
* Category object is at the root
* Product is linked to a Category (many-to-1)
* ShoppingItem is linked to a Product (many-to-1)
Application setup:
My application has a TabBarController at the root and a tableviewcontroller at the root of each of the tabs.
- The first tableviewcontroller shows all ShoppingItems
- It uses a NSFetchedResultsController to retrieve the data
- The sortdescriptor for this controller is set as "Product.Category.Name"
- The sectionNameKeyPath is set as "Product.Category.Name"
- There's no predicate set
- Cache name is set for this NSFRC
- This helps me group the shopping items based on its product categories into sections.
- The second tableviewcontroller shows all Products
- It uses a NSFRC as well to retrieve the data
- Sortdescriptor -- "Category.Name"
- SectionNameKeyPath -- "Category.Name"
- The predicate set is "Active == 1" - to load only active products
- Cache name is set for this NSFRC as well
- This helps me group the products based on its categories into sections.
Scenario:
- When I change the category associated with a product through a third screen, the tableview which displays products refreshes itself appropriately, by reslotting the product into a different (and correct) section
- But the same isn't happening on the tableview which displays the shopping items
- It is not an issue with the predicates I guess, as the problem is not about missing items, it is more about the items slotted in the wrong section.
Both the tableviewcontrollers are setup the same way to be notified by the NSFRCDelegate when changes to section and row info happen.
Any clues as to what's happening here? Is this behaviour correct?
P.S. : Am @ work and not able to post code snippets. Can go home and do it, if that would help.