• 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: Programmatically creating CoreData Entities - Source Code for Newbies?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Programmatically creating CoreData Entities - Source Code for Newbies?


  • Subject: Re: Programmatically creating CoreData Entities - Source Code for Newbies?
  • From: Vince Ackerman <email@hidden>
  • Date: Fri, 31 Mar 2006 09:04:49 -0800

Thanks,

I have read and re-read that document, and what I'm having trouble with is the organization of my project... I have a controller object to handle all the parsing and handing off the data / creating each instance of an entity. But what is not evident (at least to me) is how to set up my project... sounds kinda basic. Amongst other things, I'm confused about which objects need NSControllers. Hoping to find an example of something similar to see how it's done.




On Mar 31, 2006, at 08:06, I. Savant wrote:

Vince:

Do you mean you want to create *instances* of your entities? In any case, what's wrong with the Core Data Programming Guide? It demonstrates this quite clearly:

http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/ index.html

As long as you're familiar enough with Cocoa to parse your text file, you're already most of the way there. To create an instance of your entity takes only one line:

id myEntityInstance = [NSEntityDescription insertNewObjectForEntityForName:@"MyEntity" inManagedObjectContext: [self managedObjectContext]];

You can then manipulate "myEntityInstance" by setting its attributes, manipulating its relationships, etc.

You can then tell the context to process the changes (to ensure that your interface updates properly, etc.) by doing:

[myManagedObjectContext processPendingChanges];

(Assuming "myManagedObjectContext" is a valid reference to your context).

Hope this helps.
_______________________________________________
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: Programmatically creating CoreData Entities - Source Code for Newbies?
      • From: Scott Anguish <email@hidden>
References: 
 >CoreData app random crash on startup (From: Matt Neuburg <email@hidden>)
 >Programmatically creating CoreData Entities - Source Code for Newbies? (From: Vince Ackerman <email@hidden>)

  • Prev by Date: Re: Double click in QTMovieView
  • Next by Date: Re: Programmatically creating CoreData Entities - Source Code for Newbies?
  • Previous by thread: Programmatically creating CoreData Entities - Source Code for Newbies?
  • Next by thread: Re: Programmatically creating CoreData Entities - Source Code for Newbies?
  • Index(es):
    • Date
    • Thread