App Launch Via Document Click not calling windowControllerDidLoadNib

Discussion in 'Mac Programming' started by stadidas, Aug 11, 2008.

  1. stadidas macrumors regular

    Joined:
    Feb 27, 2006
    Location:
    Kent, United Kingdom
    #1
    Hi all,

    I'm stuck with what appears to be an embarrassingly simple problem with a new small document based app I'm writing. I can save files and open them perfectly well, and when the app is running, a double clicked document will open correctly. However, when the app is not already running, when I double click a document, the app launches, loads all of the data from the file (I've checked this by having it write info out to a text file), but then does not call windowControllerDidLoadNib.
    I imagine there could possibly be something in the target settings or possibly interface builder that needs setting, but I can't think what it could be. Any nudges in the right direction would be greatly appreciated.
     
  2. stadidas thread starter macrumors regular

    Joined:
    Feb 27, 2006
    Location:
    Kent, United Kingdom
    #3
    When my document loads, it takes the root object (an NSMutableArray) from the NSData object passed in. I've found, by overriding the set method for the array, that windowControllerDidLoadNib is not called when the array is set to a new array containing objects of the type it is meant to contain. When I changed the method to just assign a new empty array, it works perfectly well, which seems a trifle odd.
    I then found that if I remove the binding of my tree controller to the file owner (MyDocument) array, and set it programatically in windowControllerDidLoadNib, then the problem goes away. However, the windowControllerDidLoadNib method seems to fail after the tree controller contents is set, and the top of the window just says "window".
     
  3. stadidas thread starter macrumors regular

    Joined:
    Feb 27, 2006
    Location:
    Kent, United Kingdom
    #4
    Never mind, it turned out to be a bindings issue as not all of the objects in the tree are of the same type, and one type wasn't KVC-compliant for a key required by another controller.
     

Share This Page