I have to used JSON web Services for Login Validation, If Data become send is true then i catch it but How Can i handle if i get's null, Is there any method to compare null object ?
my code is like this
NSMutableDictionary *jons =[NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&error];
NSLog(@"%@",jons);
NSMutableArray *rnameary = [jons objectForKey:@"posts"];
NSLog(@" rname Arry is : %@",rnameary );
NSLog(@" Rname count is %d",[rnameary count]);
if([rnameary isEqual:[NSNull class]]) {
NSLog(@"%d",[rnameary count]);
}
output if Valied user
2012-03-23 12:30:58.353 [1503:f803] rname Arry is : (
{
IsDoctor = 1;
PHCIDF = 3;
UserIDP = 9;
UserName = Manoj;
isAdmin = 0;
}
)
output is invalied user
2012-03-23 12:29:40.944 [1481:f803] rname Arry is : (
"<null>"
)