How can I check if an object in an NSArray is NSNull? How can I check if an object in an NSArray is NSNull? ios ios

How can I check if an object in an NSArray is NSNull?


id object = myArray[0];// similar to [myArray objectAtIndex:0]if(![object isEqual:[NSNull null]]){    //do something if object is not equals to [NSNull null]}


if (myArray != (id)[NSNull null])

OR

if(![myArray isKindOfClass:[NSNull class]]) 


Building off of Toni's answer I made a macro.

#define isNSNull(value) [value isKindOfClass:[NSNull class]]

Then to use it

if (isNSNull(dict[@"key"])) ...