Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8285553
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T11:29:53+00:00 2026-06-08T11:29:53+00:00

I have a data structure in Core Data like so… User Item Category User

  • 0

I have a data structure in Core Data like so…

User

Item

Category

User has a toMany relationship “FavouriteItems” to the Item entity.
Category also has a toMany relationship “Items” to the Item entity.

The user can select favourite items from any categories they wish. At the moment I am listing all the items and then displaying the Category alongside.

What I’d like to do is display all the user’s favouriteItems for a selected Category.

i.e. select all the Items that have a relationship with Category x and User y.

I’m currently doing this by getting all the Items through one relationship (i.e. User.favouriteItems) and then filtering the NSSet using a block predicate.

Is it possible though to do this with a simple CoreData predicate?

Hmm… thinking about it would a predicate like this work…

[NSPredicate predicateWithFormat:@"interestedUser.id = %@ AND category.id = %@", user.id, category.id];

And then run a fetch request on the item entity?

Would that work?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T11:29:54+00:00Added an answer on June 8, 2026 at 11:29 am

    Shooting pretty blind as that’s an awkward scenario to set up just to answer a question but perhaps

    If you are filtering an array of Items which has the correct inverse relationships set up.

    [NSPredicate predicateWithFormat:@"%@ IN interestedUsers AND %@ IN categories", 
                                     someUser, 
                                     someCategory];
    

    Basically the Item has many users (interestedUsers) so we are saying is our user in this collection.

    Similarly the Item has many categories (categories) so we are saying AND is our chosen category in this collection.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a data structure where an entity has times stored as an int
I have a Core Data model structure like the following: Product <-->> OrderProduct where
I'm using Core Data and I have a file-folder tree-like structure. So I've created
I have this structure in a entity of core data: ID Region SubRegion SubRegionID
I have a Core Data structure with Restaurants and Atmospheres, where a restaurant can
My table have data structure like this cate_id task_id date_start date_end other 34 14
I have a Core Data structure set up. In my application delegate, I have:
I have a set of core, complicated JavaScript data structures/classes that I'd like to
I have a core data structure of Books and Bundles. A book can belong
I have an iphone app that has a sqlite db, mapped to core data.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.