Re: Hang when Nib is loaded
Re: Hang when Nib is loaded
- Subject: Re: Hang when Nib is loaded
- From: Yakov Zaytsev <email@hidden>
- Date: Fri, 11 May 2007 20:40:31 +0400
Well, I've loaded Nib without error at the end
But there's last question.
Controller's window field is nil after *successful* Nib load. How can
I track window pointer from Nib in order to initialize Controller's
one to make thing go?
TIA
On May 11, 2007, at 7:30 PM, Manfred Schwind wrote:
Controller init look like this..
- (id) init
{
self = [super init];
NSApplicationLoad(); // Needed for Carbon based
applications which call into Cocoa
if (! [NSBundle loadNibNamed:@"CampaignWindow" owner:self]) {
NSLog(@"failed to load CampaignWindow nib");
}
sharedController = self;
return self;
}
When I activate C-source [*] via menu in my Carbon application it
hangs.. I've looked up this from the GDB being attached to the
process..
Shocking endless loop..
Most probably you have an instance of your Controller inside the nib.
This would explain the endless loop:
You start instantiating a Controller in code; init is called for that
Controller.
In the init method, you load the CompaignWindow.nib (with your
Controller as file's owner).
When Cocoa loads the nib, it instantiates another Controller (because
you created an instance with Interface Builder in that nib).
The init method of this second Controller (just loaded from the nib)
is also called ...
and so the second Controller also loads a nib that has a third
Controller within ... and so forth and so forth ...
The solution:
Open the nib in Interface builder and remove all Controller instances
you may have created in the nib.
Instead, click on the File's Owner icon and change the "Custom Class"
of that thing to "Controller".
Every connection you have made to your Controller instance then has
to be made to the File's Owner.
Regards,
Mani
--
http://www.mani.de
iVolume - Loudness adjustment for iTunes.
LittleSecrets - The encrypted notepad.
---
Yakov Zaytsev
Envion Software http://www.envionsoftware.com
<Talk Small and Carry a Big Class Library>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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