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: "Bill So" <email@hidden>
- Date: Wed, 17 May 2006 20:49:09 +0800
Dear George,
Thanks for your help.
I tried similar things as u do. Tried create NSPersistentDocument and
single window Core Data app. And both use the same data model as the
one that ran into trouble.
Strange, both testing apps work.
Tried to compare different the test apps with my current app. I don't
really find anything wrong.
Really strange...
Is it just my problem? Or, Core Data + binding is not that stable?
Thanks again for your help.
Bill
On 5/14/06, George Orthwein <email@hidden> wrote:
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