Re: Compiler has trouble distinguishing between a class and its superclass
Re: Compiler has trouble distinguishing between a class and its superclass
- Subject: Re: Compiler has trouble distinguishing between a class and its superclass
- From: "Ewan Delanoy" <email@hidden>
- Date: Thu, 22 Mar 2007 13:19:25 +0100 (CET)
- Importance: Normal
>Does the window know which subclass is supposed to handle it? I.e. did
>you set the custom class in Interface Builder?
Yes, the custom class of "File's Owner" is set correctly to
"SchreibenDocument", my
NSDocument subclass. (I mean, the "Model" representatives (IBOutlets)
of the UI objects in the nib are all stored in the NSDocument subclass
instead of the NSWindowController subclass, and this is bad practice
I guess, but at first my project involved no NSWindowController
subclassing and I added it only recently).
My makeWindowControllers: method looks like this :
-(void) makeControllers
{
BZHWindowController* wc=[[BZHWindowController alloc]
initWithWindowNibName:@"SchreibenDocument"
owner:self];
[self addWindowController:wc];
[wc release];
}
Ewan
> Does the window know which subclass is supposed to handle it? I.e. did
> you set the custom class in Interface Builder?
>
> Best,
> Micahel
>
> On 3/22/07, Ewan Delanoy <email@hidden> wrote:
>> Hello all,
>>
>> in my Cocoa project I have an NSDocument subclass and a
>> NSWindowController
>> subclass called BZHWindowController. The project compiles fine without
>> any
>> warnings,
>> but an exception is raised at runtime. The line that triggers it is the
>> second of
>> the two below (which are inside the
>> windowControllerDidLoadNib: method of the NSDocument subclass):
>>
>> BZHWindowController* wc=[self theOnlyWindowController];
>> [wc setTitleMustBeLocalized: (![self fileURL])];
>>
>> The error message goes, [NSWindowController setTitleMustBeLocalized:]:
>> selector not recognized [self = 0x529a00]
>>
>> Now it is admittedly true that the class NSWindowController does not
>> have a method
>> "setTitleMustBeLocalized:" ; however, my subclass BZHWindowController
>> does. It seems
>> that the compiler doesn't really know if the wc instance is a
>> NSWindowController or a
>> BZHWindowController, from what the debugger says :
>>
>> (gdb) p wc
>> $1 = (class BZHWindowController *) 0x5adb90
>> Current language: auto; currently objective-c
>> (gdb) po wc
>> <NSWindowController: 0x5adb90>
>>
>> How can I fix this ?
>>
>>
>> Ewan
>>
>>
>> _______________________________________________
>>
>> 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
>>
>
>
> --
> Michael Ströck
> Langobardenstraße 9
> 1220 Wien, AUSTRIA
> Phone: +43-676-84556044
> Fax: +43-1-2821199-21
>
>
_______________________________________________
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