Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to check if array is null or empty in ios sdk?

Tags:

xcode

ios

iphone

I want to check if my Bond is empty or null and NULL value.

{
Bonds =(
      {
        DOB = "12/09/1988";
        about = "";
      }
      );
User =     {
    city = CA;
    email = "[email protected]";
};
success = True;
}

Second time this type get data how to check Bond key

{
Bonds = Null;
User =     {
    city = CA;
    email = "[email protected]";
};
success = True;
}
like image 476
Gami Nilesh Avatar asked Dec 02 '22 18:12

Gami Nilesh


1 Answers

You just check for nil

if(data[@"Bonds"]==nil){
  NSLog(@"it is nil");
}

or

if ([data[@"Bonds"] isKindOfClass:[NSNull class]]) {
    NSLog(@"it is null");
}
like image 104
meda Avatar answered Dec 18 '22 13:12

meda