I have a User entity and an Email entity. A user has many emails. If I have a User object, I can access the set of emails with [user emails]. But how can I use an NSPredicate to retrieve all emails for a user? Assume there is no inverse relationship.
Share
There should be an inverse relationship, or else the program would give you a warning. you can do something like:
Keep in mind that, if you already have the user, you can just get the emails from the user object. An one-to-many relationship is represented in this user object as an NSSet, which you can use either to access all emails from it, or to sort the set into an array. Use the fetch if you need to use an NSFetchResultsController of some sort.