gpt4 book ai didi

ios - 如何编写BOOL值的条件

转载 作者:行者123 更新时间:2023-12-01 20:02:02 25 4
gpt4 key购买 nike

这是我的回应

1.{

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

}
2.
{

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

}

NSString *abc5 = [abc4 valueForKey:@"image"];
NSLog(@"%@",abc5);

这里第一个响应图像是数据,第二个响应图像是无数据。然后如何编写if条件。

最佳答案

基于URL,您必须这样做:

    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]])
{
NSLog(@"YES");
//here you have to add your image as usual to another mutable array
}else{
NSLog(@"NO");
// bool value happens means this will execute
// Here you have to add custom image ie.placeholder image
}

}
}

就是这样

关于ios - 如何编写BOOL值的条件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39768348/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com