我目前正在使用 AFNetworking 的自定义UIImageView+AFNetworking.h
从 URLS 下载两个图像,如下所示:
[self.topPicture setImageWithURL:upperPicture];
[self.bottomPicture setImageWithURL:lowerPicture];
大约 20% 的时间可以正常工作,尽管其余时间我收到以下错误:
<Error>: ImageIO: CGImageReadSessionGetCachedImageBlockData *** CGImageReadSessionGetCachedImageBlockData: readSession [0x8a4ebd0] has bad readRef [0x8a50f30]
我不确定这是因为我试图同时将两个图像设置到屏幕上(以及在主线程上),还是因为我没有正确配置 AFNetworking。
更新:
我正在使用 Parse API 的查询功能使用代码获取用户的个人资料图片
NSArray *foundMatches = [queryForMatches findObjects]; //each "match" is a NSDictionary
其中查询也在主线程上运行。稍后,我使用类似于
matchedUser[@"user_picture"] //user_picture is a string, which I then set to a new NSURL withString
在将它传递给setImageWithURL:
函数之前。至少从我所见,一切都在主线程上检索。
更新 2:
我尝试只使用 下载一张图片getImageWithURL
,这工作正常,我没有收到上述错误。