Bug in Project Builder? And IB???
Bug in Project Builder? And IB???
- Subject: Bug in Project Builder? And IB???
- From: Geoff <email@hidden>
- Date: Sun, 26 Aug 2001 22:36:36 -0400
Hi everyone,
OK, here is the problem:
Create a new Cocoa Application project.
Create a custom subclass of NSObject (for example) (.h and .m files)
with the New File... menu or by hands and put some instance variables
(like some IBoutlet).
Save.
Try to compile... everything's fine.
Now, well I've changed my mind. This custom class should be a
NSWindowController subclass - because it is finally going to control
a window - in my nib file the custom instance is already hooked up to
many buttons. So I decide to change the source files and I'll make IB
parse the files.
So I substitute
@interface MyCustomController : NSWindowController {
to
@interface MyCustomController : NSObject {
and make sure you have the right header files (e.g. #import <AppKit/AppKit.h>).
AND I add a method. Actually I override windowDidLoad: (for example)
In that method I call the corresponding method of the new superclass:
- (void)windowDidLoad
{
[super windowDidLoad];
int i;
for (i=0;i<12;i++)
{
// do nothing more than the superclass, which actually does nothing itself
}
}
So now let's compile that. Huh... Error!! It turns out that PB still
believes that my class inherits from NSObject, and yields a parse
error due to [super windowDidLoad];
What's weird is that it looks as if PB parse the .h file, so it
should know that my customclass now inherits from NSWindowController.
It seems it still "assumes" something in the background, although my
.h changed and thus should have been reparsed. That's what is written
in the files that should matter, right? Apparently not.
Am I missing something or is it really a bug? Please be indulgent, I
am quiet new to Cocoa.
If somebody has some time (Apple?), please try this at home!
It is all the more weird than IB is also puzzled and won't be able -
upon parsing - to add the two outlet and action (window and
showWindow:) that comes with subclasses of NSWindowController.
Note: Rewriting the exact same code, that "crashes" the compiler, in
new files, SOLVE the problem.
Cheers,
Geoffroy Lenglin
---------------------------------
*** IB and PB rock ... as long as you have a transcendantal vision of
their docs ***