• 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: NSArrayController Difficulties
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSArrayController Difficulties


  • Subject: Re: NSArrayController Difficulties
  • From: Michael Niessner <email@hidden>
  • Date: Sun, 5 Feb 2006 16:20:54 -0600

I figured out my problem. I was registering for the notification more than once. Sorry for the noise.

Michael

On Feb 5, 2006, at 3:30 PM, Michael Niessner wrote:

I have a MutableArray that contains some ManagedObjects(all objects are the same entity) and an object that is not managed(which is just an NSMutableDictionary). I use an NSArrayController to display the array in a popup menu.

Whenever an entity is added or removed to the ManagedObjectContext, I would like this array to be updated.

So, I registered for the NSManagedObjectContextObjectsDidChangeNotification, and then check the NSInsertedObjectsKey to see if any of the inserted objects should be added to my MutableArray. If it should be added, then I call the NSArrayController's addObjects: method in order to add the entity to the MutableArray and the popup menu.

With this setup, on the first Insertion I get one notification. However, on the second insertion I get two notifications. For the third insertion I get four notifications. If I do not call the addObjects method, I only get one notification for each insertion. However, if I do call the addObjects method I get 2^n insertions.

What am I doing wrong?

Thanks,
Michael

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40aventive.com


This email sent to email@hidden


_______________________________________________ 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: 
 >NSArrayController Difficulties (From: Michael Niessner <email@hidden>)

  • Prev by Date: Re: Universal Binaries and messages to nil
  • Next by Date: How to create and show an NSButton programmatically?
  • Previous by thread: NSArrayController Difficulties
  • Next by thread: Universal Binaries and messages to nil
  • Index(es):
    • Date
    • Thread