LShi LShi - 1 year ago 36
Objective-C Question

`NSTreeController`'s `arrangedObjects` doesn't respond to `children`

In the

doc it says:

The value of this property represents a proxy root tree node
containing the tree controller’s sorted content objects. The proxy
object responds to children and descendant(at:) messages. This
property is observable using key-value observing.

But in the following code the
never hits its body.

#import "NSTreeController+RootNodes_m.h"

@implementation NSTreeController (RootNodes_m)

- (NSArray *) rootNodes {
NSObject * arranged = self.arrangedObjects;

if ([arranged respondsToSelector: @selector(children)]) {
return [arranged performSelector:@selector(children)];
return nil;


I wrote this Obj-C category because in my Swift project I can't turn on "whole module optimization" when I archive the product for release when using a "hack" from this question. So I tried adding this category, which got me even "worse" result.

Answer Source

When you're using Objective-C, you should look at the Objective-C version of the docs. The page you linked to has a Language selector toward the top-right.

In the Objective-C docs, you'll find that the proxy responds to -childNodes, not -children.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download