This could be the simplest one but I am not able to find the exact cause. Instead to explain in words following is my code:
NSString *str = @"";
NSInteger tempInteger = [str integerValue];
if (tempInteger == 0)
{
NSLog (@"do something");
}
If NSString
returning NULL
then NSInteger
returning 0 and if NSString
has some value then NSInteger
returning same value.
But when NSString
is NULL
then I want NSInteger
should return NULL
not 0 but I am not able to validation NSInteger
as NULL
.
How can I get NULL
value in NSInteger
if NSString
is NULL?