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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:13:17+00:00 2026-06-14T21:13:17+00:00

I have a NSOutlineView that show the content controlled by a NSTreeController which I

  • 0

I have a NSOutlineView that show the content controlled by a NSTreeController which I bind to an NSMutableArray (arrayOfFiles). The array contains NSTreeNode objects where the representedObject (Fileobject class) holds a number of ivars. I would like to edit and update the ivar named “direction” for specific objects. I manage to get my object of interest using a NSIndexPath which I have stored for each object.

[self.myOutlineViewController.myTreeController setSelectionIndexPath:myIndexPath];

Fileobject *myObject =[[[self.myOutlineViewController.myTreeController.arrangedObjects descendantNodeAtIndexPath:myIndexPath] representedObject] representedObject];

[myObject setDirection:0];

This works fine, but I run into problems when I want to update the object I just extracted at NSIndexPath. The following crashes:[self.myOutlineViewController.myTreeController removeObjectAtArrangedObjectIndexPath:myIndexPath]; with the error message

An uncaught exception was raised
2012-11-08 17:23:25.557 S3access[20379:12b03] *** -[NSKeyValueSlowMutableArray     removeObjectsAtIndexes:]: value for key myArrayOfFiles of object 0x40012e460 is nil

I understand i am doing something wrong with Key-Value coding here but I am unable to see what it is. I have tried to seek solutions in all of the examples from Apple but I can only find examples that do not use NSTreeController and NSTreeNode. My thought was to 1) extract the object at indexpath 2) edit the extracted object 3) remove current object at indexpath 4) insert my new edited object into indexpath using command [self.myOutlineViewController.myTreeController insertObject:myNode atArrangedObjectIndexPath:myIndexPath];. I dont see how I can replace my object using Key-Value coding when I dont replace only an ivar but the whole object?

Any suggestions for what I am doing wrong and suggestions for how I may solve this is highly appreciated.

Cheers, and thanks! Trond

  • 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-06-14T21:13:19+00:00Added an answer on June 14, 2026 at 9:13 pm

    I finally managed to get my update of NSOutlineView to work properly, and since my question was an extreme tumbleweed I thought I would at least update with an answer. It turns out my problem was more a lack of proper understanding of KVC rather than a programming problem. After having read answers to questions on Stackoverflow and the Apple documentation I finally figured out how to enable a dynamic update of my NSOutlineView and its NSTreeController contents (arrangedObjects) which are represented using NSTreeNode. The following code worked for me assuming you know the NSIndexPath (myIndexPath) of your object:

    [self.myOutlineViewController.myOutlineView willChangeValueForKey:@"direction"];
    [[[[self.myOutlineViewController.myTreeController.arrangedObjects descendantNodeAtIndexPath:myIndexPath] representedObject] representedObject] setDirection:0];
    [self.myOutlineViewController.myOutlineView didChangeValueForKey:@"direction"];
    

    Hopefully this may help some others. Cheers, Trond

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

Sidebar

Related Questions

I have a NSOutlineView which is binded to my NSTreeController. The content of the
In my app, I have an NSOutlineView that gets its data from a NSTreeController
Now that we have NSTableView and NSOutlineView that can have regular NSView objects as
I have a non document-based Core Data application. There's an NSTreeController that manages a
I have a tree-like model I'd like to show in an NSOutlineView using an
I have an NSOutlineView that I want to populate with a list of NSURL
I have an NSOutlineView and what I want to happen is that when a
I currently have an NSOutlineView, which has an NSButton above it. When the NSOutlineView
I have a View-based NSOutlineView bound to a NSTreeController. Everything seems to work correctly
I've got a simple NSOutlineView bound to an NSTreeController that's providing access to my

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.