gpt4 book ai didi

ios - 出现错误 [UIImage mutableCopyWithZone :]: unrecognized selector sent to instance

转载 作者:行者123 更新时间:2023-11-28 18:10:52 28 4
gpt4 key购买 nike

处理 JSON 数据并从字典中提取图像并将图像添加到数组

  NSURL *imageurl=[NSURL URLWithString:(NSString *) Dictionry[@"product"][@"image_medium_url"]];
NSData *data = [NSData dataWithContentsOfURL:imageurl];
UIImage *image = [UIImage imageWithData:data];
[self.productImageArray addObject:image];

我正在将这个数组复制到另一个数组

for(int i=0;i<prodReq.productNameArray.count;i++)
{

[productimageA addObject:[[prodReq.productImageArray objectAtIndex:i] mutableCopy]];
}

并将图像设置为 ImageView

UIImageView *productimage=[[UIImageView alloc]initWithFrame:CGRectMake(15, prodimgY, 60, 75 )];
productimage.image=[productimageA objectAtIndex:indexPath.row];

当我运行这个项目时出现这个错误

 -[UIImage mutableCopyWithZone:]: unrecognized selector sent to instance 0x14581240

有什么问题吗?

最佳答案

您正在将 UIImage 添加到 productImageArray。您不需要为 UIImage 对象添加 mutableCopy。所以就用

[productimageA addObject:[prodReq.productImageArray objectAtIndex:i] ];

关于ios - 出现错误 [UIImage mutableCopyWithZone :]: unrecognized selector sent to instance,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20673385/

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