How do you check if an array is empty? (for the record, I looked at similar questions but didn't find the one with this exact problem).
I have a NSMutableArray
(let's call it nsma
)that I need to check if empty. If I do NSLog(@"nsma: %@",nsma);
it logs nsma: ( )
, but if I do NSLog(@"nsma count:%@",nsma);
it logs nsma: (null)
. I need to check if it is empty, but my if statement that does that isn't working for some reason:
if (nsma == nil)
{
NSLog(@"nsma is empty");
}
Does anyone know what is going on?
Thanks for the help in advance.
if([nsma count] == 0)
{
NSLog(@"nsma is empty");
}
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