Re: unused window initializer in document-based cocoa app
Re: unused window initializer in document-based cocoa app
- Subject: Re: unused window initializer in document-based cocoa app
- From: Kyle Sluder <email@hidden>
- Date: Wed, 7 Oct 2009 23:47:48 -0700
On Sun, Oct 4, 2009 at 3:23 AM, Eimantas Vaičiūnas
<email@hidden> wrote:
>- (id)init {
> self = [super initWithWindowNibName:@"BlankDoc"];
>
> if (self != nil) {
> NSRect windowFrame = NSMakeRect(100.0f, 800.0f, 500.0f, 500.0f);
> self.window = [[BlankWindow alloc] initWithContentRect:windowFrame
You're calling -initWithWindowNibName:, giving it a nib with a window
already in it. Therefore it is unnecessary to create yet another
window. Just hook up the existing one in the nib to File's Owner's
window outlet.
> *** -[BlankWindow initWithFrame:]: unrecognized selector sent to instance
NSWindow doesn't have an -initWithFrame: method, so this should be an
immediate indication to you that something is very wrong. Especially
if you haven't written any code that tries to call -initWithFrame: on
an NSWindow.
This is usually an indication of a memory management bug. After
fixing your first problem, with NSZombieEnabled to see where your
memory bug is.
--Kyle Sluder
_______________________________________________
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