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 8932393
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:18:49+00:00 2026-06-15T09:18:49+00:00

I am having trouble writing a fetch request that will fetch data objects based

  • 0

I am having trouble writing a fetch request that will fetch data objects based on the contents of a to-many relationship. One table is for photos and the other is for tags. Each photo can have multiple tags and each tag can have multiple photos.

So, the data model is: Photos <<–>> Tags. Photo has an attribute called ‘title’ and a relationship called ‘tags’. Tag has an attribute called ‘label’ and a relationship called ‘taggedPhotos’. I have created subclasses for both object types. (I’m working on the Stanford CS193p course).

I want a fetch request predicate for the Photo entity that will select photo objects if their ‘tags’ relationship contains a given tag label. So if I have a label called ‘architecture’ I want a match with any photos that have ‘architecture’ as one of their tags.

  • 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-15T09:18:50+00:00Added an answer on June 15, 2026 at 9:18 am

    If I am understanding you correct I think the predicate should be like:

    NSPredicate *predicate = [NSPredicate predicateWithFormat:
    @"ANY tags.label LIKE %@", @"searchKey""];
    

    and for sure it’s a request on the photo entity.

    Here is the Apple NSPreciate Documentation for further information

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

Sidebar

Related Questions

I'm having trouble writing a regular expression (suitable for PHP's preg_match()) that will parse
I am having trouble writing query so that I can query the content of
I'm having trouble reading and writing QByteArray data to a file. My goal is
I am having some trouble with writing a unit test that checks my custom
I am having trouble writing C++ code that uses a header file designed for
I am having trouble writing a query on a mysql table of user activity
I'm having trouble writing an XPath expression to select nodes that contain certain elements,
I am having trouble writing a stored procedure that first checks a hashed password
I'm having trouble writing a unit test for one of my controller actions. Here's
I am having trouble writing a sql query and I was hoping that someone

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.