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

2

1 Answer 1

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];
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.