views:

130

answers:

1

Hi,

I'm trying to follow Marcus Zarra in his book 'Core Data'. In the book, he makes a small sample application, but it doesn't give much help when things don't work out...

He starts out by visually designing three entities, and then adding array controllers for each entity to the main nib. Second, he adds a tableview and some other visual components to show data from the array controllers.

So far, I have managed to follow, but now he adds a search field to the gui, and binds it to the same array controller as one of the tableviews. Expected behavior would be for the tableview to get filtered when typing in the search field, but nothing happens.

How do I find out what's wrong?

The relevant parts from the nib is as follow:

NSArrayController Recipes
- Mode = Entity
- Enitity Name = Recipe

TableView w/TableColumn
- Value Bind To Recipes
-- Controller Key = arrangedObjects -- Model Key Path = name

Search Field
- Predicate Bind To Recipes
-- Controller Key = filterPredicate
-- Model Key Path = name
-- Display name = predicate
-- Predicate Format = keyPath contains $value

There are no relevant messages in the console.

regards,
-Vegar

+3  A: 

The book example is wrong and will be fixed in the next printing. You can remove the Model Key Path entirely as it is never read and change the predicate format to:

name contains[c] $value
Marcus S. Zarra
And, voila, it workes! Thanks.
Vegar