Set array empty

I have a history button that clears data in a plist. Now the download is fine; I load it into an array.

Can I just use:

self.dataClear = NULL; 

and save the array in plist to clear it? So i can use

 if([self.dataClear count] == 0)//if plist is empty 

check?

+6
objective-c iphone xcode
source share
1 answer

You should NSMutableArray use NSMutableArray and call removeAllObjects on it instead of NULLing; otherwise, there will be no object to respond to your count message, as there is a conceptual difference between an "empty array" and "without an array".

+14
source share

All Articles