• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Creating a predicate based on objectID in CoreData?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Creating a predicate based on objectID in CoreData?


  • Subject: Creating a predicate based on objectID in CoreData?
  • From: Colin Cornaby <email@hidden>
  • Date: Fri, 5 Aug 2005 18:19:24 -0700

I'm trying to run a fetch request against CoreData, and limit results to object with a specific owner. The owner has a one-to-many relationship that is inverse with it's entities. I want to search all entities in the context that have that inverse relationship to a specific owner (as there may be multiple owners each with their own sets of data). The reason I am not simply polling the relationship for it's objects is I want to pull all objects from all the relationships that the owner has.

I came up with the idea of searching based on the owners object id, and compare against the specific owner object id I want to find. Here is how I did my predicate:

NSPredicate *predicate = [NSPredicate predicateWithFormat:@"self.owner.objectID == %@", [[[ownerObjectBeingUsed objectID] URIRepresentation] path]];

This doesn't work though and I'm getting back nothing. I've NSLogged my entities within the context and verified that they all indeed to have the inverse relationship working, and I can log all the object id's that way. For example (retrieved by looping through all the entities and printing [[[entity objectID] URIRepresentation] path]):

2005-08-05 18:02:04.220 Catalyst[7409] /TKVariation/ t079FCCDA-589C-4337-89A8-1A76C476A065
2005-08-05 18:02:04.221 Catalyst[7409] /TKVariation/ t079FCCDA-589C-4337-89A8-1A76C476A065
2005-08-05 18:02:04.239 Catalyst[7409] /TKVariation/ t079FCCDA-589C-4337-89A8-1A76C476A065
2005-08-05 18:02:04.261 Catalyst[7409] /TKVariation/ t079FCCDA-589C-4337-89A8-1A76C476A065
2005-08-05 18:02:04.262 Catalyst[7409] /TKVariation/ t079FCCDA-589C-4337-89A8-1A76C476A065
2005-08-05 18:02:04.276 Catalyst[7409] /TKVariation/ t079FCCDA-589C-4337-89A8-1A76C476A065
2005-08-05 18:02:04.319 Catalyst[7409] /TKVariation/ t079FCCDA-589C-4337-89A8-1A76C476A065
2005-08-05 18:02:04.335 Catalyst[7409] /TKVariation/ t079FCCDA-589C-4337-89A8-1A76C476A065
2005-08-05 18:02:04.355 Catalyst[7409] /TKVariation/ t079FCCDA-589C-4337-89A8-1A76C476A065
2005-08-05 18:02:04.385 Catalyst[7409] /TKVariation/ t079FCCDA-589C-4337-89A8-1A76C476A065
2005-08-05 18:02:04.400 Catalyst[7409] /TKVariation/ t079FCCDA-589C-4337-89A8-1A76C476A065


Any ideas on how to properly do this search? Feel free to clarify if this is unclear at all.

---------------------------
Colin Cornaby - http://gomac.blogspot.com/
Carpe Stellarem - Lead Programmer, ProToys - http://carpestellarem.com
Macintosh Specialist - University of Portland - htttp://up.edu

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Creating a predicate based on objectID in CoreData?
      • From: Bill Cheeseman <email@hidden>
    • Re: Creating a predicate based on objectID in CoreData?
      • From: mmalcolm crawford <email@hidden>
  • Prev by Date: Re: Deleting the last word of an NSString
  • Next by Date: one additional piece of info about the pdfview problem
  • Previous by thread: pdfView: a problem of shifting origins
  • Next by thread: Re: Creating a predicate based on objectID in CoreData?
  • Index(es):
    • Date
    • Thread