Search code examples
objective-cnsmutablearray

How do I remove all objects from an NSMutableArray?


I need to remove all objects from an NSMutableArray. I can't seem to do this by enumerating as the code crashes.

Can anyone tell me the best way to do this with a code example if possible?


Solution

  • This should do the trick:

    [myArray removeAllObjects];