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

  • Home
  • SEARCH
  • 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 576157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:01:03+00:00 2026-05-13T14:01:03+00:00

Here’s my code: test.h @interface testAppDelegate : NSObject <NSApplicationDelegate> { NSWindow *window; IBOutlet NSTableView

  • 0

Here’s my code:

test.h

@interface testAppDelegate : NSObject <NSApplicationDelegate> {
    NSWindow *window;
    IBOutlet NSTableView *test;
    NSMutableArray *internalArray;
}

@property (assign) IBOutlet NSWindow *window;
@property (nonatomic, retain) NSTableView *test;
-(id) initWithArray: (NSArray*) objects;
-(int)numberOfRowsInTableView:(NSTableView *)aTableView;
-(id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn     *)aTableColumn row:(int)rowIndex;
-(void)tableView:(NSTableView *)aTableView setObjectValue:(id)anObject forTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex;

test.m (top pieces missing for simplicity’s sake)

@synthesize window;
@synthesize test;

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
    PSClient *client = [PSClient applicationClient];
    NSURL *url = [NSURL URLWithString:@"http://www.apple.com/main/rss/hotnews/hotnews.rss"];
    PSFeed *feed = [client addFeedWithURL:url];
    internalArray = [NSMutableArray array];

    // Retrieve the entries as an unsorted enumerator
    NSEnumerator *entries = [feed entryEnumeratorSortedBy: nil];
    PSEntry *entry;
    // Go through each entry and print out the title, authors, and content
    while (entry = [entries nextObject]) {
        [internalArray addObject:entry.title];
        //NSLog(@"Entry Title:%@", entry.title);
        //NSLog(@"Entry Authors:%@", entry.authorsForDisplay);
        [test reloadData];
        //NSLog(@"Entry Content:%@", entry.content.plainTextString);
    }
}

-(int)numberOfRowsInTableView:(NSTableView *)aTableView{
    NSLog(@"%@", [internalArray count]);
    return [internalArray count];
}

-(id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
{
    NSString *string = [internalArray objectAtIndex:rowIndex];
    NSLog(@"%@", string);
    // when I debug, I get same pointers with invalid data
    // each object has "name" message
    // this following line gives invalid pointer and
    // it crashes
    return string;
}

-(void)tableView:(NSTableView *)aTableView setObjectValue:(id)anObject forTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
{
    NSString *string = [internalArray objectAtIndex:rowIndex];
    NSLog(@"%@", string);
    // when I debug, I get same pointers with invalid data
    // each object has "name" message
    // this following line gives invalid pointer and
    // it crashes
    return string;
}
@end

In IB I have the tableview (test) hooked up to the app delegate: test, datasource, and delegate

For some reason the table isn’t displaying the data, and when I call [test reloadData]; the app crashes

  • 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-13T14:01:03+00:00Added an answer on May 13, 2026 at 2:01 pm

    Number one with a bullet – you don’t retain internalArray after you create it. Use one of:

    internalArray = [[NSMutableArray] alloc] init];
    internalArray = [[NSMutableArray array] retain];
    

    instead of what you currently have:

    internalArray = [NSMutableArray array];
    

    Also, I think you probably don’t want %@ for the format in this method:

    -(int)numberOfRowsInTableView:(NSTableView *)aTableView{
        NSLog(@"%@", [internalArray count]);
        return [internalArray count];
    }
    

    That code will certainly (well, often) cause a crash when you do [tableView reloadData].

    In applicationDidFinishLaunching:, you don’t need to call reloadData every time you add an object to internalArray. Just do it once at the end of that loop.

    Your implementation of setObjectValue:forTableColumn:row: also doesn’t make sense. It should look more like this:

    -(void)tableView:(NSTableView *)aTableView setObjectValue:(id)anObject forTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
    {
        NSLog(@"%@", anObject);
        [internalArray replaceObjectAtIndex:rowIndex withObject:anObject];
    }
    

    Hopefully those are some ideas to get you started.

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

Sidebar

Ask A Question

Stats

  • Questions 306k
  • Answers 306k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Instead of using UIColor *bgColor = [[UIColor alloc] initWithWhite:1 alpha:0.0];… May 13, 2026 at 9:21 pm
  • Editorial Team
    Editorial Team added an answer I don't know what the data in your ListView looks… May 13, 2026 at 9:21 pm
  • Editorial Team
    Editorial Team added an answer You can modify a session id to include a short… May 13, 2026 at 9:21 pm

Related Questions

I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
Is it possible to replace javascript w/ HTML if JavaScript is not enabled on
Here's a basic regex technique that I've never managed to remember. Let's say I'm
Here's a problem I ran into recently. I have attributes strings of the form

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.