Re: CoreData and ManagedObjects
Re: CoreData and ManagedObjects
- Subject: Re: CoreData and ManagedObjects
- From: Wain <email@hidden>
- Date: Thu, 23 Mar 2006 21:39:15 +0000
Hi,
Your calling entityForName: inManagedObjectContext:, this is a class
method on NSEntityDescription (as can be seen from how the call is
made), which returns an NSEntityDescription - not an NSManagedObject.
You probably don't want to take this approach at all as the Managed
Object you want should be the current (selected) item when the "load
picture" button is pressed.
Are you using bindings?
Wain
On 23 Mar 2006, at 20:10, Bobby B wrote:
Hello everyone!
I'm building a CoreData application, and I'm having some trouble
accessing the properties of my entities. From what I've been reading,
it seems to access a CoreData entity and it's properties (as keys),
you do the following:
NSData * myData = [NSData dataWithContentsOfFile:[op filename]];
NSManagedObjectContext * context = [[NSApp delegate]
managedObjectContext]; NSManagedObject * girlEntity =
[NSEntityDescription entityForName: @"Girl" inManagedObjectContext:
context];
[girlEntity setValue:myData forKey: @"image"];
[girlEntity didChangeValueForKey:@"image"];
(I've also tried, in place of context, [self [managedObjectContext])
My Entity in xcdatamodel is "Girl", and it has a property called
"image" that is set to "Binary." I have the above code in a "load
picture" action. When the user clicks "load button", it does the
above code, plus setting the image outlet to the correct picture (via
the myData).
However, when I go to the next record, then come back, the image is
still set as the original image. It seems that I'm not getting my
changes to "stick".
Any ideas?
Thank you everyone,
Bobby
_______________________________________________
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