On Jul 1, 2010, at 11:30 AM, Rainer Standke wrote:

> I have a core data app where I don't necessarily know when managed objects go 
> away, as in: become faults, will be deleted etc.. I also need to add the 
> observer to the managed object in awakeFromFetch, but that gets not only 
> called upon opening an existing object, but also later on when fetches are 
> executed.
> 
> I take it the answer to my question is no? As in: No, an object can not ask 
> another if it's being observe by it?

Specifically, no, because an object is completely ignorant of what it is 
observing, except when specifically implemented otherwise. The observed object 
*does* know what objects have registered with it, but the data structure is 
opaque and undocumented, and subject to change (AFAIK).

> For now I have solved the problem by setting a flag on the managed object 
> when it registers itself for observation. 
> 
> Rainer
> 
> 
> On Jul 1, 2010, at 9:15 , Kyle Sluder wrote:
> 
>> On Jul 1, 2010, at 8:26 AM, Rainer Standke <li...@standke.com> wrote:
>> 
>>> Hello all,
>>> 
>>> is it possible to determine if one object is observing another? 
>>> Specifically, I'd like one object to ask another "are you observing me?". 
>>> That way I could determine if I need to remove that observer before I let 
>>> go of the observed object...
>> 
>> This is a very good indication that you have an inverted or cyclical 
>> dependency. Your observee shouldn't need to know about your observers.
>> 
>> What is your specific setup?
>> 
>> --Kyle Sluder


Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to