File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -208,22 +208,16 @@ - (void)deleteObject:(id)dict
208208}
209209
210210- (void )deleteAllObjectsForBucketName : (NSString *)bucketName {
211- // NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
212- // NSEntityDescription *entity = [NSEntityDescription entityForName:entityName inManagedObjectContext:context];
213- // [fetchRequest setEntity:entity];
214- //
215- // // No need to fault everything
216- // [fetchRequest setIncludesPropertyValues:NO];
217- //
218- // NSError *error;
219- // NSArray *items = [context executeFetchRequest:fetchRequest error:&error];
220- //
221- // for (NSManagedObject *managedObject in items) {
222- // [context deleteObject:managedObject];
223- // }
224- // if (![context save:&error]) {
225- // NSLog(@"Simperium error deleting %@ - error:%@",entityName,error);
226- // }
211+ dispatch_sync (self.storageQueue , ^{
212+ // Nuke Bucket Entities from the `allObjects` collection
213+ NSDictionary <NSString *, SPObject *> *bucket = [self .objects objectForKey: bucketName];
214+ for (NSString *key in bucket.allKeys ) {
215+ [self .allObjects removeObjectForKey: key];
216+ }
217+
218+ // And now nuke the entire bucket
219+ [self .objects removeObjectForKey: bucketName];
220+ });
227221}
228222
229223- (void )validateObjectsForBucketName : (NSString *)bucketName
You can’t perform that action at this time.
0 commit comments