Getting NSArrayController content after application launch

  • Hi,

    I have a small Core-Data application which uses an NSArrayController
    to manage
    a collection of entites. Adding and removing works fine. My
    application has a StatusItem
    in the StatusBar and I want to select the entities from the
    NSArrayController via the
    menu.
    When I call [myController arrangedObjects] in the awakeFromNib method
    of my ApplicationController
    it returns an empty array. I guess this is because the data hasn't
    been loaded (when I
    call the method later in the app it returns an array with all the
    entities). So my question is:
    How can I get the content of the NSArrayController after it has loaded
    its content?

    Thank you very much in advance.

    Best regards,
    Michael
  • > How can I get the content of the NSArrayController after it has
    > loaded its content?

      In your subject line, you say, "after application launch". Perhaps
    [NSApp applicationDidFinishLaunching:] would do? ;-)

      Also, you may need to send your array controller a -fetch: before
    asking it for its contents.

    --
    I.S.
  • On Dec 29, 2007, at 11:07 AM, Michael Grützner wrote:

    > When I call [myController arrangedObjects] in the awakeFromNib
    > method of my ApplicationController
    > it returns an empty array. I guess this is because the data hasn't
    > been loaded (when I
    > call the method later in the app it returns an array with all the
    > entities). So my question is:
    > How can I get the content of the NSArrayController after it has
    > loaded its content?
    >
    This is an FAQ.  See "Troubleshooting Core Data" > "Bindings
    Integration".

    mmalc
previous month december 2007 next month
MTWTFSS
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31            
Go to today