Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3300666
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T20:40:57+00:00 2026-05-17T20:40:57+00:00

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

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T20:40:57+00:00Added an answer on May 17, 2026 at 8:40 pm

    In IB I have a NSBUtton, NSTableView, NSArrayController and a NSOBject (named AppController)

    Don’t you want your AppController instance in IB to be an instance of your AppController class? My apologies if that is already the case (then I’m just understanding your statement wrong).

    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.

    I think this is fine (someone correct me if I’m wrong). When you bind your arrayController to your appController’s fileList attribute, your arrayController will then access the fileList by way of KVC mechanism. So as long as your appController class (or at least it’s fileList attribute) is KVC-compliant, arrayController will be able to see appController’s fileList just fine. Cocoa relies heavily on coding convention.

    I’m also new to Cocoa, so I could be wrong about everything that I just said.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.