M尝试在运行时在核心数据中添加属性。
但是当我尝试执行代码时,它将返回如下错误:Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Resgistration setProperties:]: unrecognized selector sent to instance 0x6080000a5400
请帮帮我。
NSEntityDescription *entity = [NSEntityDescription insertNewObjectForEntityForName:@"Resgistration" inManagedObjectContext:context];
//NSManagedObject *object = [[NSManagedObject alloc] init];
NSMutableArray *attribute = [[NSMutableArray alloc] init];
NSMutableArray *attribute1 = [[NSMutableArray alloc] init];
NSAttributeDescription *nameAttribute = [[NSAttributeDescription alloc] init];
[nameAttribute setName:@"lastAdd"];
[nameAttribute setAttributeType:NSStringAttributeType];
[nameAttribute setOptional:NO];
[nameAttribute setIndexed:YES];
[attribute addObject:nameAttribute];
[entity setProperties:attribute];
NSManagedObjectModel *objectModel = nil;
[attribute1 addObject:entity];
[objectModel setEntities:attribute1];