0

I have:

self.path = [self pathByCopyingFile:@"Notes List.plist"];
self.data = [[NSMutableDictionary alloc] initWithContentsOfFile:self.path];
self.notes = [self.data objectForKey:@"Notes"];

Then in a button (Button method definitely gets called):

NSString *title = self.navigationItem.title;
         //Filter notes array by title
         NSPredicate *pred = [NSPredicate predicateWithFormat:@"Title =[cd] %@", title];
         NSArray * titleArray = [self.notes filteredArrayUsingPredicate:pred];

         //delete all the notes with the old title name
         [self.notes removeObject:titleArray];
         NSLog(@"%@", self.notes);

At this point, self.notes still contains the items and i dont know why they arnt being removed

rmaddy
  • 314,917
  • 42
  • 532
  • 579
user3001526
  • 81
  • 2
  • 12

1 Answers1

3

You are trying to remove an array from the array. That's not what you want. I believe your goal is to remove all of the objects in the titleArray from your notes array.

And this doesn't even consider that self.notes is probably an NSArray and not an NSMutableArray.

If self.notes is mutable you can use the removeObjectsInArray:.

[self.notes removeObjectsInArray:titleArray];
rmaddy
  • 314,917
  • 42
  • 532
  • 579