Re: Displaying Core Data using Cocoa binding programmatically
Re: Displaying Core Data using Cocoa binding programmatically
- Subject: Re: Displaying Core Data using Cocoa binding programmatically
- From: George Orthwein <email@hidden>
- Date: Sat, 13 May 2006 14:38:37 -0400
Yeah, it still sounds like a bindings setup problem to me... which
leads me to wonder if you tried the option-drag GUI test. :) I just
think it's great for debugging and checking how stuff should be
setup. Whoever thought that up at Apple has my gratitude.
In my experience, the NSArrayController should "just work"—
insertNewObjectForEntityForName: should be all that is needed for the
object to appear in the appropriately bound table views. Or at least
it should in the very simple case you've described. So if the data is
being created... then that just leaves the controller and binding setup.
The only thing I saw in your code is that you refer to the MOC once
as [appDelegateObj managedObjectContext] and once as [self
managedObjectContext]. If appDelegateObj is pointing to something
else that could be the problem.
But I created a new Core Data project, created an entity with a
single attribute, option-dragged it into IB and added the following
awakeFromNib to the existing AppDelegate file and saw no problems.
- (void)awakeFromNib;
{
NSManagedObject * myObj = [NSEntityDescription
insertNewObjectForEntityForName:@"Entity"
inManagedObjectContext:[self managedObjectContext]];
[myObj setValue:@"testing" forKey:@"name"];
[[self managedObjectContext] save:NULL];
}
So something must be set up a little differently in your case.
George
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden