我需要一些帮助。我使用 AlamofireImage UIImageView 扩展在 UITableView 中加载一些图标。我的项目使用了一些用 Objective-C 编写的第三方库。
代码:
class TableCell: UITableViewCell {
@IBOutlet weak var logo: UIImageView!
@IBOutlet weak var name: UILabel!
func setData(provider: ServiceProvider) {
name.text = provider.name
let url = NSURL(string: provider.logoUrl)!
self.logo.af_setImageWithURL(url)
}
override func prepareForReuse() {
super.prepareForReuse()
logo.af_cancelImageRequest()
logo.layer.removeAllAnimations()
logo.image = nil
}
}
错误:
-[UITableViewCellContentView af_cancelImageRequest]: unrecognized selector sent to instance 0x787ea430
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITableViewCellContentView af_cancelImageRequest]: unrecognized selector sent to instance 0x787ea430'
*** First throw call stack:
(
0 CoreFoundation 0x02eb1494 exceptionPreprocess + 180
1 libobjc.A.dylib 0x03d6ee02 objc_exception_throw + 50
2 CoreFoundation 0x02ebb253 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x02df089d ___forwarding_ + 1037
4 CoreFoundation 0x02df046e CF_forwarding_prep_0 + 14
5 AlamofireImage 0x005d324c _TFE14AlamofireImageCSo11UIImageView25af_setImageWithURLRequestfTP9Alamofire21URLRequestConvertible_16placeholderImageGSqCSo7UIImage_6filterGSqPS_11ImageFilter__8progressGSqFT9bytesReadVs5Int6414totalBytesReadS5_24totalExpectedBytesToReadS5__T__13progressQueuePSo17OS_dispatch_queue_15imageTransitionOES_S0_15ImageTransition26runImageTransitionIfCachedSb10completionGSqFGVS1_8ResponseS3_CSo7NSError_T___T + 476
6 AlamofireImage 0x005d2f85 TFE14AlamofireImageCSo11UIImageView18af_setImageWithURLfTCSo5NSURL16placeholderImageGSqCSo7UIImage_6filterGSqPS_11ImageFilter__8progressGSqFT9bytesReadVs5Int6414totalBytesReadS4_24totalExpectedBytesToReadS4__T__13progressQueuePSo17OS_dispatch_queue_15imageTransitionOES_S0_15ImageTransition26runImageTransitionIfCachedSb10completionGSqFGV9Alamofire8ResponseS2_CSo7NSError_T___T + 933