Build Error: tableView undeclared


#1

When building the completed application I get this error in the windowControllerDidLoadNib method.
Build Error: tableView undeclared

- (void)windowControllerDidLoadNib:(NSWindowController *)windowController { [super windowControllerDidLoadNib:windowController]; // user interface preparation code NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; NSData *colorAsData; colorAsData = [defaults objectForKey:BNRTableBgColorKey]; [tableView setBackgroundColor:[NSKeyedUnarchiver unarchiveObjectWithData:colorAsData]]; }

I solved this problem by adding “IBOutlet NSTableView *tableView;” to MyDocument.h.
In the next step I connected the Outlet “tableView” of the File’s Owner in MyDocument.xib to the Table View itself.

After another Build&Run everything seems ok and the Background Color is set to the selected value.

Now my question:
Is there something missing in this chapter or did I something wrong, so that I have to fix it that way? :confused:

I hope you understand what I want to say. :blush:


#2

My file “MyDocument.h” has an outlet for tableView. Perhaps you missed that line and forgot to put it in.

//
//  MyDocument.h
//  RaiseMan
//
//  Created by Aaron Hillegass on 9/24/07.
//  Copyright __MyCompanyName__ 2007 . All rights reserved.
//


#import <Cocoa/Cocoa.h>
@class Person;

@interface MyDocument : NSDocument
{
	NSMutableArray *employees;
	IBOutlet NSTableView *tableView;
	IBOutlet NSArrayController *employeeController;
}

- (IBAction)createEmployee:(id)sender;
- (void)removeObjectFromEmployeesAtIndex:(int)index;
- (void)insertObject:(Person *)p inEmployeesAtIndex:(int)index;
- (IBAction)removeEmployee:(id)sender;

@end

#3

You didn’t skip chapter 9 by any chance? The IBOutlet NSTableView etc. stuff was added in this chapter IIRC


#4

Oh my god, now I got it:

Chapter 9, 10 are about the application “RaiseMan”.
Chapter 11 is about “CarLot”.
Chapter 12 and 13 again “RaiseMan”. <— In this chapters I thought we are in “CarLot” which is build with CoreData (this is the reason I had to add the outlet manually). So I did all the described changes in the wrong Project! :smiley: Made a challenge for myself without even knowing it… :blush:

Sorry for this stupid Topic, now everything seems clear to me.

Thanks for your help!