• 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: Predicate Builder & Fetched Properties
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Predicate Builder & Fetched Properties


  • Subject: Re: Predicate Builder & Fetched Properties
  • From: mmalcolm crawford <email@hidden>
  • Date: Tue, 5 Jul 2005 14:48:43 -0700


On Jul 5, 2005, at 1:04 PM, Charilaos Skiadas wrote:

On Jul 5, 2005, at 2:49 PM, mmalcolm crawford wrote:
<<http://developer.apple.com/documentation/Cocoa/Reference/ CoreData_ObjC/Classes/NSFetchedPropertyDesc.html>
"The effect of a fetched property is similar to executing the fetch request yourself and placing the results in a transient attribute, although with the framework managing the details. In particular, a fetched property is not fetched until it is requested, and the results are then cached until the object is turned into a fault. You use -refreshObject:mergeChanges: (NSManagedObjectContext) to manually refresh the properties—this causes the fetch request associated with this property to be executed again when the object fault is next fired."

I've read this, but maybe I haven't fully understood it. So, if I understand correctly, there are two options:
1) I can write code for the fetch request myself.


Do you mean, you can simply create and execute a fetch request periodically? Of you can put a fetch request in an accessor method?

2) I can have any controller that changes things that affect the given property call a refreshObject:mergeChanges: each time it changes things.
It's this second option that I expected one could do through KVO, without having to write any code. So I guess the question is: can one register the fetched property to observe changes in some keys,


Can you register it using setKeys:triggerChangeNotificationsForDependentKey:? -- no.
You can add your own observation code...


But most importantly, why would one need to write code about this at all? I guess maybe I've gotten too spoiled with CoreData, but I would expect this to be exactly the sort of thing that CD would allow you to do without any code.

Please file an enhancement request.

On a related note, maybe I've missed it, but I haven't been able to find a lot of examples on the web about how to use fetched properties and fetch requests, so if someone can point me to some links, I would appreciate it.

What additional examples or explanation would you like? I think these cover all the uses of fetch requests:

<http://developer.apple.com/documentation/Cocoa/Reference/ CoreData_ObjC/Classes/NSManagedObjectContext.html#//apple_ref/doc/uid/ TP30001182-BAJDFCJJ>
<http://developer.apple.com/documentation/Cocoa/Conceptual/ CoreDataUtilityTutorial/07_Fetch/chapter_8_section_2.html#//apple_ref/ doc/uid/TP40001800-CH230-DontLinkElementID_32>
<http://developer.apple.com/documentation/Cocoa/Conceptual/ NSPersistentDocumentTutorial/04_Department/chapter_5_section_3.html#// apple_ref/doc/uid/TP40001799-CH223-DontLinkElementID_25>


See also, <http://developer.apple.com/documentation/Cocoa/Conceptual/ Predicates/Articles/pCreating.html>.)

There are also several source examples in Core Recipes <http:// developer.apple.com/samplecode/CoreRecipes/CoreRecipes.html>.

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


References: 
 >Predicate Builder & Fetched Properties (From: Jeff LaMarche <email@hidden>)
 >Re: Predicate Builder & Fetched Properties (From: mmalcolm crawford <email@hidden>)
 >Re: Predicate Builder & Fetched Properties (From: Charilaos Skiadas <email@hidden>)
 >Re: Predicate Builder & Fetched Properties (From: mmalcolm crawford <email@hidden>)
 >Re: Predicate Builder & Fetched Properties (From: Charilaos Skiadas <email@hidden>)

  • Prev by Date: CFURLGetFSRef vs. FSPathMakeRef
  • Next by Date: Catching system-level exceptions with NS_DURING
  • Previous by thread: Re: Predicate Builder & Fetched Properties
  • Next by thread: Re: Predicate Builder & Fetched Properties
  • Index(es):
    • Date
    • Thread