Note that there are some explanatory texts on larger screens.

plurals
  1. POarrayController "valueForUndefinedKey": why it gets istantiated immediately?
    primarykey
    data
    text
    <p>My application has 2 windows, both of them are displaying NSScrollView objects managed by a controller. Basically the first has the data, the second has a proper aggregation of the data. Both are relying of an implementation of NSArrayController class.</p> <p>I designed both windows properly (I believe so at least) but I keep getting this error:</p> <pre><code> [&lt;MyDocument 0x1020257c0&gt; valueForUndefinedKey:]: this class is not key value coding-compliant for the key &lt;MY_ARRAY&gt;. </code></pre> <p>The only way I managed to solve this was to instantiate immediately (I mean when the first window gets prepared) the second array and populate it with some values this way:</p> <pre><code>NSMutableArray *newAggregates = [NSMutableArray array]; [newAggregates addObject: [NSMutableDictionary dictionaryWithObjectsAndKeys: [NSString stringWithString:@"category"], @"category", [NSString stringWithString:@"subcategory"], @"subcategory", [NSNumber numberWithFloat:0.0], @"amount_1", [NSNumber numberWithFloat:0.0], @"amount_2", [NSNumber numberWithFloat:0.0], @"amount_3", [NSNumber numberWithFloat:0.0], @"amount_4", [NSNumber numberWithFloat:0.0], @"amount_5", [NSNumber numberWithFloat:0.0], @"amount_6", [NSNumber numberWithFloat:0.0], @"amount_7", [NSNumber numberWithFloat:0.0], @"amount_8", [NSNumber numberWithFloat:0.0], @"amount_9", [NSNumber numberWithFloat:0.0], @"amount_10", [NSNumber numberWithFloat:0.0], @"amount_11", [NSNumber numberWithFloat:0.0], @"amount_12", [NSNumber numberWithFloat:0.0], @"total", nil]]; [self setAggregates:newAggregates]; </code></pre> <p>This works, but it is not what I wanted, I want the second array to be executed only optionally, if and only if the user presses a certain button.</p> <p>Is there a way to accomplish that, or any array controller present in the application has to be instantiated at the beginning? I am absolutely sure there must be a way to avoid that...</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload