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

NSArrayController Difficulties


  • Subject: NSArrayController Difficulties
  • From: Michael Niessner <email@hidden>
  • Date: Sun, 5 Feb 2006 15:30:45 -0600

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSArrayController Difficulties
      • From: Michael Niessner <email@hidden>
  • Prev by Date: Re: Beast approach for doing a syntax coloring editor?
  • Next by Date: Universal Binaries and messages to nil
  • Previous by thread: Re: Beast approach for doing a syntax coloring editor?
  • Next by thread: Re: NSArrayController Difficulties
  • Index(es):
    • Date
    • Thread