我正在尝试删除特定属性
tipdescription | tip number | tipindex
go to school | 001 | 21
come home | 004 | 54
lock home | 008 | 86
我将如何删除整列“锁定家”?我试过下面的代码
app = [[ UIApplication sharedApplication] delegate];
NSFetchRequest *req = [[NSFetchRequest alloc]init];
[req setEntity:[NSEntityDescription entityForName:@"Tips" inManagedObjectContext:app.managedObjectContext]];
NSString *deletestatement =[[NSString alloc] initWithFormat:@"lock home"];
[req setPredicate:[NSPredicate predicateWithFormat:@"tipdescription LIKE %@", deletestatement]];
NSError *error;
Tips *std = [[app.managedObjectContext executeFetchRequest:req error:&error] lastObject];
[app.managedObjectContext deleteObject:std];
运行它后,我收到以下错误:
由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“-deleteObject:需要非零参数