Re: Editing core data attributes via code
Re: Editing core data attributes via code
- Subject: Re: Editing core data attributes via code
- From: mmalcolm crawford <email@hidden>
- Date: Mon, 20 Jun 2005 13:44:28 -0700
On Jun 20, 2005, at 1:04 PM, J. Atwood wrote:
// Here's where I go astray.
NSManagedObject *user = nil;
user = [NSEntityDescription entityForName:@"User"
inManagedObjectContext:
[TestAppDelegate managedObjectContext]];
Umm, entityForName:... returns an NSEntityDescription, not an
NSManagedObject:
<http://developer.apple.com/documentation/Cocoa/Reference/
CoreData_ObjC/Classes/NSEntityDescription.html#//apple_ref/doc/uid/
TP30001173-BBCIAAFJ>
Essentially, I have a master-detail window with a list of users and
their attributes, respectively. One of the details is password
field where a user can set their password. As soon as control
leaves the text box, I want to replace the password just entered by
the user (now saved by core data into the application's data store)
with the MD5 digest of the password.
How is the detail set up? That is, how do you know what is the
currently-selected User? If you're using bindings, then I assume
you're using an array controller? In which case you can simply send
its selection a setValue:forKey: message...
NSManagedObject *user = [arrayController selection];
[user setValue: passwordHash forKey: @"password"];
}
mmalc
_______________________________________________
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