• 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: [Q] What causes an NSArrayController to know that an entity was inserted via a different window?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Q] What causes an NSArrayController to know that an entity was inserted via a different window?


  • Subject: Re: [Q] What causes an NSArrayController to know that an entity was inserted via a different window?
  • From: Michael Ash <email@hidden>
  • Date: Tue, 24 Feb 2009 21:11:54 -0500

On Tue, Feb 24, 2009 at 3:37 PM, Jon C. Munson II <email@hidden> wrote:
> 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.

It's good that you're not convinced, because it's not the best way. In
fact, I believe it could very well be the absolute worst way possible.

What happens if the description of one of the other objects just
happens to look like the description for yours? Disaster.

You know that you have an NSSet. The documentation for NSSet will tell
you how to inspect it to discover the presence or absence of an object
within it, without going through such a crazy roundabout process.

Mike
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • RE: [Q] What causes an NSArrayController to know that an entity was inserted via a different window?
      • From: "Jon C. Munson II" <email@hidden>
References: 
 >[Q] What causes an NSArrayController to know that an entity was inserted via a different window? (From: "Jon C. Munson II" <email@hidden>)
 >Re: [Q] What causes an NSArrayController to know that an entity was inserted via a different window? (From: "I. Savant" <email@hidden>)
 >RE: [Q] What causes an NSArrayController to know that an entity was inserted via a different window? (From: "Jon C. Munson II" <email@hidden>)
 >Re: [Q] What causes an NSArrayController to know that an entity was inserted via a different window? (From: "I. Savant" <email@hidden>)
 >RE: [Q] What causes an NSArrayController to know that an entity was inserted via a different window? (From: "Jon C. Munson II" <email@hidden>)

  • Prev by Date: Re: Metrics for a NSTextField
  • Next by Date: Re: Moving oneself to /Applications (or ~/Applications)
  • Previous by thread: Re: [Q] What causes an NSArrayController to know that an entity was inserted via a different window?
  • Next by thread: RE: [Q] What causes an NSArrayController to know that an entity was inserted via a different window?
  • Index(es):
    • Date
    • Thread