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?
NSArray creates static arrays, and NSMutableArray creates dynamic arrays.
The NSMutableArray class declares the programmatic interface to objects that manage a modifiable array of objects. This class adds insertion and deletion operations to the basic array-handling behavior inherited from NSArray .
This should do the trick:
[myArray removeAllObjects];
In Swift 3:
yourArry.removeAllObjects()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With