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 6234511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T10:29:58+00:00 2026-05-24T10:29:58+00:00

With the delegate and datasource connections made, I have the following controller: #import <Foundation/Foundation.h>

  • 0

With the delegate and datasource connections made, I have the following controller:

#import <Foundation/Foundation.h>

@interface KextTable : NSObject <NSTableViewDataSource> {
@private
    NSArray *klist;
}
- (int)numberOfRowsInTableView:(NSTableView *)tableView;
- (id)tableView:(NSTableView *)tableView
objectValueForTableColumn:(NSTableColumn *)tableColumn
            row:(int)row;
@end

and

#import "KextTable.h"


@implementation KextTable

- (id)init
{
    self = [super init];
    if (self) { 
}    
    return self;
}

-(void) awakeFromNib 
{
    klist = [[NSArray alloc] init];

    klist = [NSArray arrayWithObjects: @"1", @"2",
             @"3", @"4", nil]; // debugging values only
}

- (void)dealloc
{
    [super dealloc];
}

- (int)numberOfRowsInTableView:(NSTableView *)tableView
{
    return [klist count];
}

- (id)tableView:(NSTableView *)tableView
objectValueForTableColumn:(NSTableColumn *)tableColumn
            row:(int)row
{
    return [klist objectAtIndex:row];
}

@end

And this code is crashing with EXC_BAD_ACCESS in my main interface control where the view is switched to the tab containing the table view. What is wrong?

(I know that connections are right, if I create the array in objectValueForTableColumn it works)

  • 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-24T10:29:59+00:00Added an answer on May 24, 2026 at 10:29 am

    It’s because the klist you’re creating (the debug one) is using the constructor that autoreleases it. So you should add in:

    klist = [[NSArray arrayWithObjects: @"1", @"2", @"3", @"4", nil] retain];
    

    Be sure to note that in what you’ve done there’s a memory leak (you create an NSArray and then re-assign the variable to something else…)

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

Sidebar

Related Questions

I have a UIViewController that implements TableViews delegate and datasource protocols. Now I want
I have added a UITableView in IB and set the delegate and datasource and
I have a class MyCLController with a property dataSource that is data source delegate
I have a UIViewController that has a UIPickerView. The picker's datasource and delegate are
I am using a custom class as the delegate and datasource on a UITableView.
I have this delegate in C#. public delegate string ACSharpDelegate(string message); How would I
I have a question regarding setting up a custom delegate class for use with
I have a view controller set up as follows: UIViewController In IB I have
On JBoss 5.1.0 I have Datasource (PostgreSQL 8.3.11) configured using *-ds.xml (standard jboss DS).
I am follwing a tutorial from a book and there the delegate and datasource

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.