0

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.

Yep
  • 653
  • 5
  • 20

1 Answers1

1

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.

rdelmar
  • 103,982
  • 12
  • 207
  • 218
  • Oh my gosh, I totally didn't make that clear. These are entities I'm talking about, not a directory. I'll update the question. Thanks for your answer though, appreciate the time. – Yep Jul 30 '12 at 03:15
  • @Yep, sorry I misunderstood your question. See my edited answer. – rdelmar Jul 30 '12 at 03:53
  • This is on OS X, as indicated by my tags. OS X doesn't have `NSFetchedResultsController`. – Yep Jul 30 '12 at 04:00
  • I didn't say to use an NSFetchedResultsController. You create the fetch request with an NSFetchRequest class method, and execute it with the method I mentioned, which is method of NSManagedObjectContext, both of which are available in OS X. – rdelmar Jul 30 '12 at 04:07
  • :/ I'm so tired tonight. Thanks! – Yep Jul 30 '12 at 04:13