I have a NSMutableArray when I try to delete object from it, object is not being deleted. And when I debug my code there is data in it.
Here is my code -
NSMutableArray *myArray = [array copy];
// array is NSArray which contains data
[myArray removeObjectAtIndex:0];
It will not delete object from this array because your NSMutableArray has become Immutable.
You're making copy of NSArray instead of it make mutableCopy it will work -
NSMutableArray *myArray = [array mutableCopy];
Or you can also use initWithArray: method.
NSMutableArray *myArray = [[NSMutableArray alloc] initWithArray:array];
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