Re: Bug in Project Builder? And IB???
Re: Bug in Project Builder? And IB???
- Subject: Re: Bug in Project Builder? And IB???
- From: Vince DeMarco <email@hidden>
- Date: Sun, 26 Aug 2001 20:32:06 -0700
On Sunday, August 26, 2001, at 07:36 pm, Geoff wrote:
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.
We just fixed this the version of IB due out soon fixes this problem.
Note: Rewriting the exact same code, that "crashes" the compiler, in new
files, SOLVE the problem.
THe problem is that PB doesn't realize that it needs to compile the .m
file if the .h file changes (Its dependency mechanism has a few bugs)
Try making clean and rebuilding everything. Or edit the .m file and then
recompile.
vince