Re: Fun (or not) with NSArrayControllers and CoreData.
Re: Fun (or not) with NSArrayControllers and CoreData.
- Subject: Re: Fun (or not) with NSArrayControllers and CoreData.
- From: Daniel DeCovnick <email@hidden>
- Date: Fri, 31 Jul 2009 15:11:38 -0700
On Jul 31, 2009, at 2:26 PM, Quincey Morris wrote:
On Jul 31, 2009, at 10:33, Daniel DeCovnick wrote:
-(IBAction)newJob:(id)sender
{
id folder = [self currentFolder];
CCCEJob *newJob = [NSEntityDescription
insertNewObjectForEntityForName:@"CCCEJob" inManagedObjectContext:
[self managedObjectContext]];
[folder addJobsObject:newJob];
newJob.rootFolder = [newJob getRootFolder];
}
Perhaps I was wrong about the inverse relationship getting set KVO-
compliantly. Instead of:
newJob.rootFolder = [newJob getRootFolder];
you could try:
[[newJob getRootFolder] addAllDescendantsJobsObject: newJob];
That worked! The result was wrong, but making the rootFolder
relationship into rootFolders and making it to-many, changing
getRootFolder to -(NSArray *)allContainingFolders, and sending
everything in that the addAllDescendantsJobsObject: message worked
perfectly. Still, it's slightly disconcerting that setting the
property doesn't set the inverse relationship. How are you supposed to
change it later?
On a mostly unrelated note, is the only way to suppress the "no '-
addJobsObject:'/'-addAllDescendantsJobsObject:' method found" warnings
to create the Folder custom subclass and paste the Core Data method
declarations in? That approach seems like overkill since I have
nothing to customize in it.
Anyways, thanks muchly, onto the next part of the application!
-Daniel
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden