Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

stadidas

macrumors regular
Original poster
Feb 27, 2006
243
0
Kent, United Kingdom
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.
 

stadidas

macrumors regular
Original poster
Feb 27, 2006
243
0
Kent, United Kingdom
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".
 

stadidas

macrumors regular
Original poster
Feb 27, 2006
243
0
Kent, United Kingdom
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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.