• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Editing core data attributes via code
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Editing core data attributes via code (From: "J. Atwood" <email@hidden>)

  • Prev by Date: [Moderator] End Of Thread (Re: Outline and Table back to front)
  • Next by Date: Fwd: QT & Cocoa
  • Previous by thread: Re: Editing core data attributes via code
  • Next by thread: core data/table column sorting question
  • Index(es):
    • Date
    • Thread