How to check if array is null or empty?

if ([array count] == 0)

If the array is nil, it will be 0 as well, as nil maps to 0; therefore checking whether the array exists is unnecessary.

Also, you shouldn't use array.count as some suggested. It may -work-, but it's not a property, and will drive anyone who reads your code nuts if they know the difference between a property and a method.

UPDATE: Yes, I'm aware that years later, count is now officially a property.


if (!array || !array.count){
  ...
}

That checks if array is not nil, and if not - check if it is not empty.