I have an NSString and I want to check if it has a NULL value. If it does, then the if condition should execute. Else it should execut
The NULL value for Objective-C objects (type id) is nil.
While NULL is used for C pointers (type void *).
(In the end both end up holding the same value (0x0). They differ in type however.)
In Objective-C:
nil (all lower-case) is a null pointer to an Objective-C object.
Nil (capitalized) is a null pointer to an Objective-C class.
NULL (all caps) is a null pointer to anything else (C pointers, that is).
[NSNull null] (singleton) for situations where use of nil is not possible (adding/receiving nil to/from NSArrays e.g.)
So to check against NSNull one can either use:
if ((NSNull *)myString == [NSNull null])
or if one wants to omit the need of casting to NSNull:
if ([myString isKindOfClass:[NSNull class]])