How to check an NSMutableArray
is null or not ?
The primary difference between NSArray and NSMutableArray is that a mutable array can be changed/modified after it has been allocated and initialized, whereas an immutable array, NSArray , cannot.
Overview. 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 .
If you want to check if it is empty:
if ([myMutableArray count] == 0) { ... }
If you want to check if the variable is nil
:
if (!myMutableArray) { ... }
or:
if (myMutableArray == nil) { ... }
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