开发者

Remove an Object/Row from a Core Data Entity

There are a couple answers similar to this (Like deleting an entire entity). But none that have worked for me. I am just looking for simple way to fetch the object I want to delete using NSPredicate and then delete only that object. I only want to delete one object/row. It should be fairly simple code, nothing too complicated. I would provide my code but I am pretty sure it won't help because it isn't even close to being complete or even workin开发者_开发知识库g.


EntityToDelete *entity = (EntityToDelete *)[NSEntityDescription insertNewObjectForEntityForName:@"EntityToDelete" inManagedObjectContext:self.managedObjectContext];  

NSError *error;  

[self.managedObjectContext deleteObject:entity];

if (![self.managedObjectContext save:&error]) {



}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜