Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


George Buckingham
George Buckingham
1,216 Points

iOS help: NSFetchedResultsController

Hi everyone :-)

I'm designing an app using Core Data, and have the following data model:

  • Activity <<-----> Goal (as in, a Goal has many Activities, an Activity has only one Goal)

I'm good with saving data in this relationship. However, I need help getting the data back. I'm using a UITableViewController and NSFetchedResultsController, and have access to an object Goal, with a property named activities.

My question: how can I use a NSFetchedResultsController with a one-to-many relationship in this way?

Hopefully you can make sense of the questions!

Cheers, George

1 Answer

George Buckingham
George Buckingham
1,216 Points

After many hours on StackOverflow, I have an answer.

Use an NSPredicate as part of your NSFetchedResultsController!