How to check if an array is empty or empty in ios sdk?

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

{
Bonds =(
      {
        DOB = "12/09/1988";
        about = "";
      }
      );
User =     {
    city = CA;
    email = "karmhadadmtl@gmail.com";
};
success = True;
}

The second time this type get data, how to check the Bond key

{
Bonds = Null;
User =     {
    city = CA;
    email = "developer.i12@gmail.com";
};
success = True;
}
+4
source share
5 answers

You just check nil

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

or

if ([data[@"Bonds"] isKindOfClass:[NSNull class]]) {
    NSLog(@"it is null");
}
+7
source
if ([data[@"Bonds"] isKindOfClass:[NSNull class]] || data[@"Bonds"] == nil || [data[@"Bonds"] isEqualToString:@""]) {

}
+5
source

[NSNull null] , .

if (dictionary[@"Bonds"] != [NSNull null]) {
    // requried data is present, now check if it is nil or empty.
}
+2

check: if (![dataArray isKindOfClass:[NSNull class]]) && &

, [dataArray firstObject] - , .

+2

:

if (!data[@"Bonds"] || ![data[@"Bonds"] count]){
    NSLog(@"Data Found");
}else{
    NSLog(@"Data Not Found");
}
+1

All Articles