• 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: Lee Morgan <email@hidden>
  • Date: Mon, 20 Jun 2005 16:31:06 -0400

I believe you need to do a fetch request. NSEntityDescription entityForName.... is just that a entity _description_ that you can use for a fetch request.
If you execute a fetch request (see NSManagedObjectContext) without a predicate then it will return all instances of the given entity, that should get you the User managed object you seek.
Also note that your setting user (of class NSManagedObject) to a instance of NSEntityDescription.

If the User managed object is connected to a conroller (object, tree or array) then you could also access it though that.

- Lee


On Jun 20, 2005, at 4:04 PM, J. Atwood wrote:

// 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?

 _______________________________________________
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: Re: Outline and Table back to front
  • Next by Date: [Moderator] End Of Thread (Re: Outline and Table back to front)
  • Previous by thread: Editing core data attributes via code
  • Next by thread: Re: Editing core data attributes via code
  • Index(es):
    • Date
    • Thread