RestKit 0.10.1: How do I create a new instance of an NSManagedObject subclass?

你说的曾经没有我的故事 提交于 2019-12-11 06:48:16

问题


I need to create a new instance of an NSManagedObject subclass, which I then intend to POST using

- (void)postObject:(id<NSObject>)object usingBlock:(RKObjectLoaderBlock)block

How do I create the object? Do I use this method?:

+ (id)insertNewObjectForEntityForName:(NSString *)entityName inManagedObjectContext:(NSManagedObjectContext *)context;

If I am supposed to use insertNewObjectForEntityName, how do I get context?


回答1:


I figured it out myself.

Say that my NSManagedObject subclass was named Blah. I can create an instance of Blah like this:

Blah *blah = [Blah object];


来源:https://stackoverflow.com/questions/12309672/restkit-0-10-1-how-do-i-create-a-new-instance-of-an-nsmanagedobject-subclass

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!