Search code examples
objective-cmacoscocoansarraycontroller

NSArrayController and specific entities


Maybe I don't understand how to use a NSArrayController correctly, but here's my situation.

I have my entities set up like this: Account -> Folder -> Chat. So I'll have lots of chats for a specific folder entity. I'm wanting my array controller to only be bound to chat entities from a specific folder entity. What's a way I can go about this? I have a reference to the folder entity that I want the chats from.


Solution

  • You need to create a fetch request using your folder entity as the argument. When you execute the request with executeFetchRequest:error:, the return value will be an array that can be bound to your array controller.