HungrySeacow
2006-04-04, 23:15
Anyone here think they can help me with this problem with CoreData? I need a method that will add an object to an entity, whose contentSet is bound to another entities selection. I have created a very easy sample program that demonstrates my problem: http://www.hungryseacow.com/Personal/CoreDataTableView.zip
The Manual Add Method button for the Source managedObject works fine, However the one for the Results managedObject does not. Take a look at the methods in the __AppController.m file
- (IBAction)addResult:(id)sender
and
- (IBAction)addSource:(id)sender
Now if you look at the Results NSArrayController, you can see that it has two bindings, the contentSet is bound to the Source's selection. There must be some way to modify this method to get it to also work with the contentSet.
- (IBAction)addResult:(id)sender
{
NSLog(@"addResult called");
NSManagedObject *source;
source = [NSEntityDescription insertNewObjectForEntityForName:@"Result"
inManagedObjectContext: [self managedObjectContext]];
[[self managedObjectContext] processPendingChanges];
}
I have been stuck on this one for a few hours! Aggg!!!
The Manual Add Method button for the Source managedObject works fine, However the one for the Results managedObject does not. Take a look at the methods in the __AppController.m file
- (IBAction)addResult:(id)sender
and
- (IBAction)addSource:(id)sender
Now if you look at the Results NSArrayController, you can see that it has two bindings, the contentSet is bound to the Source's selection. There must be some way to modify this method to get it to also work with the contentSet.
- (IBAction)addResult:(id)sender
{
NSLog(@"addResult called");
NSManagedObject *source;
source = [NSEntityDescription insertNewObjectForEntityForName:@"Result"
inManagedObjectContext: [self managedObjectContext]];
[[self managedObjectContext] processPendingChanges];
}
I have been stuck on this one for a few hours! Aggg!!!