Solution: Need to make sure you're dealing with the AppDelegate's vi
property:
// We need to make sure we're manipulating the AppDelegate's vi property!
self.vi = [[ValueItem alloc]init];
[vi setValueArray:[outArrayController arrangedObjects]];
NSArray *testArray2 = vi.valueArray; // !!!getter or setter doesn't work!!!
NSLog(@"test array 2 is:%@", testArray2);
Explanation :
On the first two lines you were manipulating the array
ValueItem
variable, then attempting to set testArray2
to the value of the uninitialized vi
ValueItem
variable.
// This is a new variable, unrelated to AppDelegate.vi
ValueItem *array = [[ValueItem alloc]init];
[array setValueArray:[outArrayController arrangedObjects]];
// Here, AppDelegate.vi hasn't been initialized, so valueArray *will* be null!
NSArray *testArray2 = vi.valueArray;
NSLog(@"test array 2 is:%@", testArray2);