Re: Circular initialization of controllers in NIB file
Re: Circular initialization of controllers in NIB file
- Subject: Re: Circular initialization of controllers in NIB file
- From: Nathan Auch <email@hidden>
- Date: Thu, 03 Jan 2008 16:39:20 -0500
I'm checking in the awakeFromNib method. I've recreated my application's
setup in a small test program, but I can't reproduce the issue that I am
seeing. I'll keep investigating and post back if/when I find a solution.
Thanks,
-Nathan
Jonathan Hess wrote:
Hey Nathan?
Outlet cycles are legal and supported. When are you expecting to see a
value for the instance variable and finding it to be nil? Are you
checking during one of your init methods? During one of your setters?
In the awakeFromNib method? The outlets of your objects won't be
established until just before awakeFromNib is invoked on your object.
Jon Hess
On Jan 3, 2008, at 11:00 AM, Nathan Auch wrote:
Alastair Houghton wrote:
On 3 Jan 2008, at 18:16, Nathan Auch wrote:
Thus, the main window controller has an IBOutlet for a panel
controller, and the panel controller has an IBOutlet for the main
window controller. These are both assigned in Interface Builder.
After loading the NIB file, the IBOutlet pointing to the main
window controller from the panel controller is never set (value is
nil). I think this must be because there is a circular dependency
during initialization of the NIB file.
No, that's not the problem. Most likely you have chosen a name for
your variable for which there is an unrelated -setSomeName: method;
that method will be being called during initialisation, rather than
just setting the variable directly.
This doesn't appear to be the case, the name of the variable was
"main_controller", I've changed it to "my_main_controller" and
reconnected the outlets in IB but I'm still seeing the same behaviour.
In general, are there any best practices for choosing variable names to
avoid the situation you describe?
What's the best way to go about debugging issues with NIB file loading?
Can I break on something specific in the debugger? In the mean time,
I'll see if I can get a small repro together, and post the code to this
list.
Kind regards,
Alastair.
--
http://alastairs-place.net
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden