title: NSTableView illegal data source
body: <p>I'm reading the book "Beginning Mac Programming" by Tim Isted and I'm stuck with a program dealing with NSTableView.
  I have a Cocoa app inherited from NSDocument. The app contains an NSTableView. I've set the data source of the Table View to File's owner. Upon execution I get  <em>*</em> Illegal NSTableView data source ().  Must implement numberOfRowsInTableView: and tableView:objectValueForTableColumn:row:</p>
  
  <p>Interface of MyDocument.h is</p>
  
  <pre><code>   #import &lt;Cocoa/Cocoa.h&gt;
  
  @interface MyDocument : NSDocument {
      IBOutlet NSTextField *newItemTextField;
      IBOutlet NSTableView *shoppingListTableView; 
      NSMutableArray *shoppingListArray;
  }
  -(IBAction)addNewItemToShoppingList:(id)sender;
  -(void)dealloc;
  -(NSInteger)numberOfRowsInTableView;
  -(id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex;
  @end
  </code></pre>
  
  <p>while implementation is</p>
  
  <pre><code>#import "MyDocument.h"
  
  @implementation MyDocument
  
  - (id)init
  {
      self = [super init];
      if (self) {
          shoppingListArray = [[NSMutableArray alloc] initWithObjects:@"pane",@"latte",@"pasta", nil];
  
      }
  
      return self;
  }
  
  -(IBAction)addNewItemToShoppingList:(id)sender{
      NSString *item = [newItemTextField stringValue];
      [shoppingListArray addObject:item];
      [shoppingListTableView reloadData];
      NSLog(@"allocated");
  
  }
  -(void)dealloc{
      [shoppingListArray release];
      [super dealloc];
  }
  -(NSInteger)numberOfRowsInTableView{
      return [shoppingListArray count];
  }
  
  -(id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex{
      return [shoppingListArray objectAtIndex:rowIndex];
  }
  </code></pre>
  
  <p>What am I doing wrong ??? Thanks a lot.</p>