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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:02:15+00:00 2026-05-23T09:02:15+00:00

I have a bewildering problem, hoping someone can assist: I have a model object,

  • 0

I have a bewildering problem, hoping someone can assist:

I have a model object, called Road. Here’s the interface.

@@@

@interface RoadModel : NSObject {

NSString *_id;
NSString *roadmapID;
NSString *routeID;

NSString *title;
NSString *description;
NSNumber *collapsed;
NSNumber *isRoute;
NSString *staff;
NSNumber *start;

NSArray *staffList;
NSMutableArray *updates;
NSMutableArray *uploads;
NSMutableArray *subRoads;

}

@property (nonatomic, copy) NSString *_id;
@property (nonatomic, copy) NSString *roadmapID;
@property (nonatomic, copy) NSString *routeID;

@property (nonatomic, copy) NSString *title;
@property (nonatomic, copy) NSString *description;
@property (nonatomic, copy) NSNumber *collapsed;
@property (nonatomic, copy) NSNumber *isRoute;
@property (nonatomic, copy) NSString *staff;
@property (nonatomic, copy) NSNumber *start;

@property (nonatomic, copy) NSArray *staffList;
@property (nonatomic, copy) NSMutableArray *updates;
@property (nonatomic, copy) NSMutableArray *uploads;
@property (nonatomic, copy) NSMutableArray *subRoads;

- (id)initWithJSONObject:(NSDictionary *)JSONObject;

@end

This part is fine.

To give you some background, I’m translating a bunch of JSON into a proper model object so it’s easier to work with.

Now, I’m trying to display this in an NSOutlineView. This is where the problem is. In particular, I have created the table and a datasource.

- (id)initWithRoads:(NSArray *)roads {

    if (self = [super init])
        root = [[NSMutableArray alloc] initWithArray:roads];

    return self;

}

- (NSInteger)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item {

    if (item == nil)
        return root.count;

    return 0;

}

- (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item {

    return NO;

}

- (id)outlineView:(NSOutlineView *)outlineView child:(NSInteger)index ofItem:(id)item {

    if (item == nil)
        item = root;

    if (item == root)
        return [root objectAtIndex:index];

    return nil;

}

- (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item {

    return [item title];

}

In the final datasource method, it attempts to return the “title” string property of the model object, but for some reason crashes each time. I have checked that the method is taking in the correct object (I checked [item class] description], and it is the right object), but for some reason if I call any of the objects accessors the app immediately crashes.

This is totally puzzling because in the init method, I can iterate through root (an array of RoadModel objects), and print any of its properties without issue. It is only when I’m trying to access the properties in any of the datasource methods that this occurs. I wonder if there is something memory-wise that is going on behind the scenes and I am not providing for it.

If you can shed some light on to this situation, it would be greatly appreciated!

Thanks in advance!

  • 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-23T09:02:15+00:00Added an answer on May 23, 2026 at 9:02 am

    Usually, this kind of thing is caused by over-releasing of objects. By the time you get to the method that crashes, either your data source or your root array has been deallocated. Don’t forget that NSOutlineView maintains a weak reference to its data source. This means that in reference counted world it does not retain the data source and in GC world, the reference is not enough to stop the data source from being collected.

    You need to maintain a retained/strong reference elsewhere.

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

Sidebar

Related Questions

Have such a problem, hope you'll help me.. Can't find anywhere. Here is the
Have a build process that can't be edited and need to pack another war
have a wierd issue. for the life of me can't trace this back (its
Have a slight problem. Trying to post XML to a server. To do this,
Have a problem with fscanf() - it does not skip to the next word
have abit of a problem with Jquery UI dialog. I set it to modal:true,
Have an app that can use tts to read text messages. It can also
Have an article model, each article has an author and publisher (both are tables).
I need some help here. Basically, I have an Activity. This uses the startActivityForResult()
Have just started using Google Chrome , and noticed in parts of our site,

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.