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 SQL problem, adding this model all works correctly, the problem is in
have written this little class, which generates a UUID every time an object of
have a problem. At first look at this HTML <div id=map style=background-image: url(map.png); width:
Have an issue with marshall and unmarshall readers and writers. So here it is.
have a nice day. I got problem when trying to create an image from
Have a form here with bunch of input text fields and a file upload
Have such user_session model: class UserSession < Authlogic::Session::Base logout_on_timeout true # default if false
Have a look at one of my websites: moskah.com The problem is that it
Have a really weird one here. The app has two targets, just to be

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.