Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>No, you don't want to instantiate an NSManagedObject via alloc/init. You should use <code>NSEntityDescription</code>'s <code>insertNewObjectForEntityForName:inManagedObjectContext:</code>. Something like:</p> <pre><code>ClassA *obj = [NSEntityDescription insertNewObjectForEntityForName:@"ClassA" inManagedObjectContext:context]; // ClassA is NSManagedObject Class </code></pre> <p>In order to have a <code>NSManagedObjectContext</code>, you also need an <code>NSPersistentStoreCoordinator</code>, and an <code>NSManagedObjectModel</code>, etc. Yeah, it's complex. <a href="http://rads.stackoverflow.com/amzn/click/0321670426" rel="nofollow">This book</a> really helped me get my head around Core Data; I recommend it wholeheartedly.</p> <p>See the <a href="https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CoreData/Articles/cdCreateMOs.html" rel="nofollow">Core Data Programming Guide section on creating and deleting managed objects</a>. Actually, while you're there, I'd recommend reading the entire <a href="https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/CoreData/cdProgrammingGuide.html#//apple_ref/doc/uid/TP30001200-SW1" rel="nofollow">Core Data Programming Guide</a>. Core Data is amazing and powerful, but it is complex; you really want to know what you're doing.</p> <p><strong>Update</strong>: The fact that you're using RestKit might change what I said above. It may be that RestKit has it's own API for doing Core Data stuff, I'm not sure. Maybe check the docs.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload