SDWebImage UIImageView+WebCache crashing on 64 bit devices

依然范特西╮ 提交于 2019-12-24 03:25:20

问题


I have this code:

#import <SDWebImage/UIImageView+WebCache.h>
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
[cell.thumbnail setImageWithURL:[NSURL URLWithString:thumbnailURL] placeholderImage:[UIImage animatedImageWithImages:loadingArray duration:1] options:indexPath.row == 0 ? SDWebImageRefreshCached : 0];
}

where "loadingArray" is just an array of png images. cellForRowAtIndexPath obviously has a lot more code.

This code works on 32 bit devices and emulator on 32 bit, but it crashes on 64 bit devices and 64 bit emulator.

Here's the crash report from XCode:

-[UIImageView setImageWithURL:placeholderImage:options:]: unrecognized selector sent to instance 0x110942780
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIImageView setImageWithURL:placeholderImage:options:]: unrecognized selector sent to instance 0x110942780'

I am using the SDWebImage-3.6 framework re-downloaded today (Apr. 22 2014) Cleaned the project, re-added the app to the emulator...same issue.

Any suggestion to fix this issue would be highly appreciated. Thank you.


回答1:


I have solved this issue by changing the Build settings of SDWebImage to "(armv7,arm64)" . Got a few errors in "NSLog" but those are easy fixes, apart from the fact that you need to change the following:

- (int)getMemoryCount
{
    return [[memCache allKeys] count];
}

in SDImageCache.m to

- (int)getMemoryCount
{
    return (int)[[memCache allKeys] count];
}


来源:https://stackoverflow.com/questions/23231340/sdwebimage-uiimageviewwebcache-crashing-on-64-bit-devices

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!