> >
> > [[NSNotificationCenter defaultCenter] addObserver:self
> >     selector:@selector(managedObjectContextUpdatedNotification:)
> >     name:NSManagedObjectContextObjectsDidChangeNotification
> >     object:[self managedObjectContext]];
> >

[Jon C. Munson II] This is the method I ended up implementing in my custom
view class.  I realized, after some thought, attempting to get my array
controller subclass to cause the view to change was actually stupid and a
violation of good programming methodology.  Thus, registering as an observer
for this notification in my custom view class allowed my view to get
notified when the MOC changed, which is what I needed.

Now, I only need to know if a specific entity in that MOC changed
(inserted/updated/deleted), so I added some processing to handle that.

I do have one question, an answer to which I could not readily find in the
dox.

In the method,
-(void)managedObjectContextUpdatedNotification:(NSNotification *)notif, the
notif contains userInfo.  [userInfo valueForKey:] returns an NSSet.  This
set has a -description, which returns a string formatted as a property list.
And there's where the documentation ends.  In the debugger console, printing
out that description gives an "array dump," so I can see what is in the
description.

My current solution is to call -rangeOfString on that description to look
for the data specific to the entity in which I'm interested (the name of the
entity in my case).  That works pretty well.  As the userInfo description
isn't too big (small entities), this works fine.  However, I'm not convinced
this is the best way to get at that data.  

So, I'd like to know how to access the properties in that list.  I couldn't
find documentation that shows what properties are actually in that list, and
I couldn't find a reference to a "property list" object in the dox (I saw
CFPreferences, but that didn't seem right).  

So, my question is, what is the preferred/best method to access the property
list to return the name of the entity that had an insertion, update, or
delete?

Thanks!

Peace, Love, and Light,

/s/ Jon C. Munson II

_______________________________________________

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