I'm trying to follow this tutorial on binding:
http://andrehoffmann.wordpress.com/2009/09/03/phonebook-tutorial-for-dummiesxcode-3-1-3/
but the app keeps crashing at run time.
In IB I have a NSBUtton, NSTableView, NSArrayController and a NSOBject (named AppController)
The tableview has 3 cols. Ad Name, Col and Height.
In AppController object I have an action titled LoadSheet and three outlets, btnLoadSheet, tblAdList and arrayController
In arrayController bindings I set it to AppController and set the Model Key Path to fileList, which is an NSMutableArray where I will be passing my table data.
In each table cell I bind them to arrayController and set the Model Key Path I set them to adName, adcol, adHeight respectively.
appController.h looks like this:
#import <Cocoa/Cocoa.h>
@interface AppController : NSWindowController {
    IBOutlet NSArrayController *arrayController;
    IBOutlet NSButton *btnAdRunner;
    IBOutlet NSButton *btnAddItem;
    IBOutlet NSButton *btnDelteItem;
    IBOutlet NSButton *btnLoadSheet;
    IBOutlet NSButton *btnQuit;
    IBOutlet NSTableView *tblAdList;
    NSMutableArray* fileList; 
}
@property (copy) NSMutableArray* fileList;
- (IBAction)AdRun:(id)sender;
- (IBAction)AddItem:(id)sender;
- (IBAction)DeleteItem:(id)sender;
- (IBAction)LoadSheet:(id)sender;
- (IBAction)QuitApp:(id)sender;
@end
appController.m:
#import "AppController.h"
@implementation AppController
@synthesize fileList; 
- (IBAction)LoadSheet:(id)sender {
    //define the ad array (this will be pulled from the run sheet
    fileList = [NSMutableArray arrayWithObjects:@"Ad1, 1, 2.5", @"Ad2, 1, 3", @"Ad3, 2, 1", @"Ad4, 1, 2.5", @"Ad5, 2, 4", nil];
    int i=0;
    for(NSString* thisdatarow in fileList) {
        //increase i
        i++;
        //make ad id
        NSString* adID = [NSString stringWithFormat:@"ad%d", i];
        //convert add data to an array from a string
        NSArray* templist = [thisdatarow componentsSeparatedByString:@","];
        //get ad items
        NSString* adname = [templist objectAtIndex: 0];
        NSString* adcols = [templist objectAtIndex:1];
        NSString* adheight = [templist objectAtIndex:2];
        //declare an array
        NSMutableArray* temparray = [[NSMutableArray alloc] initWithObjects:  adname, adcols, adheight];
        //dump temp array into arrayController
        [arrayController addObject:temparray];
    }
}
@end
I get what is going on in the larger picture but I'm lost on how to put it all together. I'm also not sure if I built it all correctly. For example, when binding arrayController to appController, the Model Key Path drop down only had self as an option, I had to manually add fileList, which kind of seemed like a red flag to me. Also, he's getting the Model Key Path for the table col binding from a plist, I'm, er, pulling them out o my butt. I am not going to be getting my data from a plist, just a text file, delimited by carriage returns and then commas. Do I dump that into a mutable dictionary so I can establish a key/value relationship and use the keys for my binding?
When the app compiles it comes out ok. Then I click the load sheet button and presto, spinning beach ball of death. I am assuming the app has no idea what I want it to do or resolve what I am asking it to do and decides to just die.
Any nudges in the right direction would be appreciated.