Checking a null value in Objective-C that has been returned from a JSON string
<null>
is how the NSNull singleton logs. So:
if (tel == (id)[NSNull null]) { // tel is null}
(The singleton exists because you can't add nil
to collection classes.)
Here is the example with the cast:
if (tel == (NSString *)[NSNull null]){ // do logic here}
you can also check this Incoming String like this way also:-
if(tel==(id) [NSNull null] || [tel length]==0 || [tel isEqualToString:@""]){ NSlog(@"Print check log");}else{ NSlog(@Printcheck log %@",tel); }