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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T11:29:49+00:00 2026-06-07T11:29:49+00:00

Im trying to do a search for a child entity based on a field

  • 0

Im trying to do a search for a child entity based on a field “guid”. The guid field is defined in the parent entity. I would like to find the child instance whos guid is equal to some value i pass in but it always returns a result of 0 values. Im assuming core data isn’t seeing the guid property since its defined in the parent entity.

Here is my predicate:

NSFetchRequest *request = [[NSFetchRequest alloc] init];

[request setEntity:[NSEntityDescription entityForName:CHILD_ENTITY inManagedObjectContext:managedObjectContext]];
[request setPredicate:[NSPredicate predicateWithFormat:@"(guid like '%@')", guid]];

NSError *error = nil;

NSArray *results = [managedObjectContext executeFetchRequest:request error:&error];

if (results != nil && results.count > 0)
    return YES;
else 
    return NO;

Is my predicate format wrong?

  • 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-07T11:29:51+00:00Added an answer on June 7, 2026 at 11:29 am

    The solution is to use the full key path of the property.

    [NSPredicate predicateWithFormat:@"parent.guid like %@", guid]
    

    That is, if parent is the name of the property which points to the logical parent you speak of.

    Of course, if by parent you mean literal inheritance (i.e. [child isKindOfClass:[parent class]] is YES), than the issue may have simply been the quotes. I have assumed that you meant a logical parent which is a different instance, and has a relationship to the child (I guess it’s OOP terms VS ORM terms, or something like that).

    Also, no need for parenthesis or quoted %@ in predicates this simple.

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

Sidebar

Related Questions

I'm trying to search through many documents and find all instances where an html
I am trying to remove the left child (10) of a sample binary search
I'm trying to write some ruby that would recursively search a given directory for
Im trying to search through a text file and find the valid email addresses.
I'm trying to write some code to find a specific XmlNode object based on
I am trying to search employees based on their code and department. I triggered
I am trying to make a child div slide into view within a parent
I've got to sprites, essentially a nucleus (parent) and an electron (child). I'm trying
I am trying to implement a Solr based search for a message thread. Each
While trying to search with id sorting (and paginating) im getting from the log:

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.