[Sandbox Configuration] Delete from storage later
Only delete from storage after deleting it from the UI list. Signed-off-by: Christopher Snowhill <kode54@gmail.com>swiftingly
parent
51f8536943
commit
3d8f470206
|
@ -77,6 +77,15 @@
|
|||
}
|
||||
|
||||
- (void)removePath:(NSString *)path {
|
||||
NSArray *objects = [[self arrangedObjects] copy];
|
||||
|
||||
for(NSDictionary *obj in objects) {
|
||||
if([[obj objectForKey:@"path"] isEqualToString:path]) {
|
||||
[self removeObject:obj];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
NSPersistentContainer *pc = [NSClassFromString(@"PlaylistController") sharedPersistentContainer];
|
||||
|
||||
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"path == %@", path];
|
||||
|
@ -93,13 +102,9 @@
|
|||
}
|
||||
}
|
||||
|
||||
NSArray *objects = [self arrangedObjects];
|
||||
|
||||
for(NSDictionary *obj in objects) {
|
||||
if([[obj objectForKey:@"path"] isEqualToString:path]) {
|
||||
[self removeObject:obj];
|
||||
break;
|
||||
}
|
||||
[pc.viewContext save:&error];
|
||||
if(error) {
|
||||
ALog(@"Error deleting bookmark: %@", [error localizedDescription]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue