Q:

Cannot check NSDictionary object's value is null or not

I try to check an objectforkey value of a NSDictionary. But I can't. 
In debug mode it says the value is this : 
    LastOrderId = "<null>"; ;
This code or modified with isEqualtoString, doesn't work.
lastorderId=[theItem objectForKey:@"LastOrderId"];
if(lastorderId==nil)
        lastorderId=@"0";

When I try to make this code work :
NSInteger *newvalue = [[theItem valueForKey:@"LastOrderId"]integerValue] ;

,it gives this error:
-[NSNull integerValue]: unrecognized selector sent to instance 0x3abeba70

How can I check that this is null or not? Thank you.

A:

Since Cocoa collections cannot store nils, a special NSNull object is stored to denote nils instead. These objects are not nils, however, so the check that you tried does not work. You can do this instead:
lastorderId=[theItem objectForKey:@"LastOrderId"];
if(lastorderId==[NSNull null]) {
    lastorderId=@"0";
}

