• 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
Editing core data attributes via code
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Editing core data attributes via code


  • Subject: Editing core data attributes via code
  • From: "J. Atwood" <email@hidden>
  • Date: Mon, 20 Jun 2005 16:04:36 -0400

Sorry for such a simple question, but I have yet to find a simple explanation for editing/changing core data attributes via code rather than GUI.

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.

(I created the data model graphically in Xcode and am using SSCrypto.)

Here's what I have.

// Saves hash of user's password.
- (void)controlTextDidEndEditing:(NSNotification *)aNotification
{
    NSString *password = [[aNotification object] stringValue];

    

    SSCrypto *crypto = [SSCrypto alloc];
    [crypto setClearTextWithString:password];

    

    NSString *passwordHash = [[crypto digest:@"MD5"] hexdump];

    // Here's where I go astray.

    NSManagedObject *user  = nil;
    user = [NSEntityDescription entityForName:@"User" inManagedObjectContext:
        [TestAppDelegate managedObjectContext]];

    [user setValue: passwordHash forKey: @"password"];
}

A. Am I getting a reference to the User managed object correctly?
B. If so, how to I set the password for the selected (in master) User? Xcode mentions that the selector is unrecognized. How can I make it so that the selector point to the currently selected user?

Thanks for any insight.

- Jeremiah Atwood
 _______________________________________________
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

  • Follow-Ups:
    • Re: Editing core data attributes via code
      • From: mmalcolm crawford <email@hidden>
    • Re: Editing core data attributes via code
      • From: Lee Morgan <email@hidden>
  • Prev by Date: Writing a draglet in Cocoa
  • Next by Date: Re: Outline and Table back to front
  • Previous by thread: Re: Writing a draglet in Cocoa
  • Next by thread: Re: Editing core data attributes via code
  • Index(es):
    • Date
    • Thread