I've decided to add an NSNumber attribute to one of my entities in core data. I Cleaned the code and deleted the app from the simulator. I then added the following code in my appDelegate and it tells me that my NSNumber attribute doesn't exist.
People *PeopleA = [NSEntityDescription insertNewObjectForEntityForName:@"People" inManagedObjectContext:context];
PeopleA.name = @"Paul";
PeopleA.number = [NSNumber numberWithInt:12];
The name attribute works just fine, that was made before and it's always worked. But when it gets to PeopleA.number
it crashes with :
-[People setNumber:]: unrecognized selector sent to instance 0x4d5eeb0
So I did a po 0x4d5eeb0
and saw that there is a name attribute but not one for number. My core data class should be good because I had XCode make it for me.
What could possibly be the issue?
Here is my People.h
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
@class Group;
@interface People : NSManagedObject {
@private
}
@property (nonatomic, retain) NSString * name;
@property (nonatomic, retain) id image;
@property (nonatomic, retain) NSNumber * number;
@property (nonatomic, retain) Group * group;
@end
People.m
#import "People.h"
#import "Group.h"
@implementation People
@dynamic name;
@dynamic image;
@dynamic number;
@dynamic group;
@end
po 0x4d5eeb0 gets me:
<People: 0x5932290> (entity: People; id: 0x59322f0 <x-coredata:///People/t83A9C7D9-4F7A-4189-9EC5-7695968A29552> ; data: {
group = nil;
name = Paul;
People.h
contents. – akashivskyynumber
property inPeople.m
file? Do you have@dynamic number;
? – akashivskyy