I have an NSArray of strings and I want to add a certain amount of rows to the outline view depending on how many strings are in the array, each with the title of the String that was added.
I think it would involve looping through the array like this.
for(NSString *title in array) {
JGManagedObject *theParent =
[NSEntityDescription insertNewObjectForEntityForName:@"projects"
inManagedObjectContext:managedObjectContext];
[theParent setValue:nil forKey:@"parent"];
[theParent setValue:@"Project" forKey:@"name"];
[theParent setValue:[NSNumber numberWithInt:0] forKey:@"position"];
}
Don’t bother. The tree controller sits between the model (The Core data store that Spark is using) and the view (your source view). Instead of adding from the array to the tree controller, you should be adding from the array to the data store.
The tree controller will pick up the changes in the model and show the changes in the view.
Edit:
(Bear in mind it is hard to debug from a distance.)
With Garbage Collection, if you don’t hold on to your objects, they are liable to be cleaned up from underneath you.
Try this and see what happens: