core data - Using a NSFetchedResultsController with an NSManagedObject and fetched properties -


i have database of cards , printings have in 1 store (reference data) , user's data of containers , cardinstances in store (as apple suggests). each user's card table cardinstance contains specific printingid corresponds specific printing of card. i'm trying use nsfetchedresultscontroller filter values of cards can manage groupings , stuff using reusable code.

again, here's basic overview of tables: card (which has namenormalized , alphanormalized , typenormalized properties want filter , group on in fetched results controller). printing (which has card relationship , specific printingid) cardinstance (which has container relationship, printingid property, , printingfetch fetched property on printing predicate: printingid = $fetch_source.printingid). container (which has to-many relationship of cardinstances).

given container, i'm wanting use nsfetchedresultscontroller can change sort , groupings between name , type sections. have fetchrequest i've set entity type cardinstance , 1 predicate container = %@, given container.

1) how set sort descriptors can sort on printingfetch.card.namenormalized or on printingfetch.card.typenormalized?

2) how filter results if want find cards containing word @"the"? thinking along lines of printingfetch.card.namenormalized contains %@, @"the", results in crash.

i realize manually, if container ends containing lot of cards, may way slow , i'd not have re-write sectioning , grouping code nsfetchedresultscontroller should automatically me.


Comments