In my application, I have two entities in database. I have a fetchedresultscontroller which displays data from first entity. I have a checkbox on each row on which when I click, my first table in database gets updated and that item gets inserted into second table.
What I want to do now is, if I disable the checkbox, I want to delete that entry from second table. Any guesses? Here is my code.
currentStatus=@"true";
NSArray *keys = [NSArray arrayWithObjects:@"xyz", @"name", @"id", nil];
NSArray *objects = [NSArray arrayWithObjects:currentStatus,name, id, nil];
NSDictionary *dictionary = [NSDictionary dictionaryWithObjects:objects forKeys:keys];
NSManagedObject *data;
data = [NSEntityDescription insertNewObjectForEntityForName:@"SecondTable" inManagedObjectContext:[self context]];
for(id key in dictionary) {
[data setValue:[dictionary objectForKey:key] forKey:key];
}
I didnt find anything like ‘deleteObjectforEntityForName’.
How about this method in NSManagedObjectContext?