• 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
Re: Object Identity Tests in Core Data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Object Identity Tests in Core Data


  • Subject: Re: Object Identity Tests in Core Data
  • From: mmalcolm crawford <email@hidden>
  • Date: Wed, 31 Aug 2005 02:23:15 -0700


On Aug 31, 2005, at 2:10 AM, Niko Matsakis wrote:

I guess it's that I didn't find documentation on what kinds of types are available in predicates.
<http://developer.apple.com/documentation/Cocoa/Conceptual/ CoreData/Articles/cdFetching.html#//apple_ref/doc/uid/TP40002484/ DontLinkElementID_18>
Yes, I read this before I posted, and also the Predicate Programming Guide. To be honest, the section here on comparing to self left me more confused then when I started.
What really confused me was this line in the code example under Retrieving Specific objects:


NSPredicate *predicate = [NSPredicate predicateWithFormat:@"self == %@", targetObject];
In case anyone cares, this is what went though my head after reading this:
1. Okay, does this mean there is a special property called "self" on every managed object?

<http://developer.apple.com/documentation/Cocoa/Conceptual/Predicates/ Articles/pSyntax.html#//apple_ref/doc/uid/TP40001795-215930>


"SELF
Represents the object being evaluated."

2. I was confused because I didn't know what type targetObject was. If it's an NSManagedObject*, which makes sense, then why are you doing the fetch? You already have the answer!

To make sure that the object is accessible from the specified context.

3. Why is it using string substitution?

It's not string substitution:
<http://developer.apple.com/documentation/Cocoa/Conceptual/Predicates/ Articles/pSyntax.html#//apple_ref/doc/uid/TP40001795/ DontLinkElementID_6>
"The format string supports printf-style format arguments such as %x (see Formatting String Objects)). Two important arguments are %@ and %K.


%@ is a var arg substitution for a value (usually a string value)."

4. Then it mentions the IN operator, but doesn't show an example.

<http://developer.apple.com/documentation/Cocoa/Conceptual/Predicates/ Articles/pUsing.html#//apple_ref/doc/uid/TP40001794-250111>

mmalc


_______________________________________________ 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: Object Identity Tests in Core Data
      • From: Niko Matsakis <email@hidden>
References: 
 >Object Identity Tests in Core Data (From: Niko Matsakis <email@hidden>)
 >Re: Object Identity Tests in Core Data (From: Chris Hanson <email@hidden>)
 >Re: Object Identity Tests in Core Data (From: Niko Matsakis <email@hidden>)
 >Re: Object Identity Tests in Core Data (From: mmalcolm crawford <email@hidden>)
 >Re: Object Identity Tests in Core Data (From: Niko Matsakis <email@hidden>)

  • Prev by Date: Re: Object Identity Tests in Core Data
  • Next by Date: Re: Object Identity Tests in Core Data
  • Previous by thread: Re: Object Identity Tests in Core Data
  • Next by thread: Re: Object Identity Tests in Core Data
  • Index(es):
    • Date
    • Thread