Siva Sankar Siva Sankar - 1 year ago 62
iOS Question

How to write the condition for BOOL values

this is my response


image = nbYijSxVXDOFGWFk8BhZUpU
"is_food_in_time_product" = 1;
"list_price" = "2.8";
name = Export;


image = 0;
"is_food_in_time_product" = 1;
"list_price" = 1;
name = "K\U00e4se";


NSString *abc5 = [abc4 valueForKey:@"image"];

Here first response image coming data, second response image no data.Then How to write the if condition.

Answer Source

Based on url you have to do like this:

            NSDictionary *responseDataDictionary = responseObject;
//here responce object is your total data which is coming from server
            NSArray *array = [[responseDataDictionary valueForKey:@"result"] valueForKey:@"products"];
            for (NSDictionary *dict in array)
                NSString *str = [dict valueForKey:@"image"];
                if([str isKindOfClass:[NSString class]])
//here you have to add your image as usual to another mutable array
// bool value happens means this will execute
// Here you have to add custom image ie.placeholder image


that's it cheers

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download