Note that there are some explanatory texts on larger screens.

plurals
  1. POCoreData issue: -[NSManagedObject setValue:]: unrecognized selector sent to instance
    primarykey
    data
    text
    <p>I just started with CoreData yesterday, and I'm going crazy :( I created a project that uses CoreData (ticked the box -use CoreData). Created the entities, and then created the NSManagedObject classes for all the entities (I suppose they create the 'setter' and 'getter' methods for the entities).</p> <p>Now, I #imported all these classes in my AppDeletegate and wrote this in my applicationDidFinishLaunching method:</p> <p>(Subscriptions is one of the Entities in the application)</p> <pre><code>NSManagedObjectContext *context = [self managedObjectContext]; Subscriptions *sbs = (Subscriptions *)[NSEntityDescription insertNewObjectForEntityForName:@"Subscriptions" inManagedObjectContext:context]; [sbs setTitle:@"OK"]; [sbs setType:@"Tag"]; [sbs setCode:@"cars"]; NSError *error = nil; if (![context save:&amp;error]) { NSLog(@"Couldn't create the subscription"); } </code></pre> <p>When I run this, I get this error</p> <blockquote> <p>[NSManagedObject setTitle:]: unrecognized selector sent to instance 0x6160550</p> </blockquote> <p>I have no idea why this is happening. Please Help!!! Thanks in advance to everyone!</p> <p><strong>Adding the header of Subscriptions</strong> <br />Subscriptions.h</p> <blockquote> <p>@interface Subscriptions : NSManagedObject { <br /> }<br /> @property (nonatomic, retain) NSString * Type;<br /> @property (nonatomic, retain) NSDecimalNumber * Read;<br /> @property (nonatomic, retain) NSString * Title;<br /> @property (nonatomic, retain) NSString * Code;<br /> @property (nonatomic, retain) NSDecimalNumber * New;<br /> @end</p> </blockquote> <p>I didn't change anything. It's just as Xcode created it.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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