簡體   English   中英

iOS:Swift:SDWebImage:cell.customImageView.sd_setImage(with:imageURL)崩潰

[英]iOS: Swift: SDWebImage: cell.customImageView.sd_setImage(with: imageURL) crashes

我將CocoaPods和SDWebImage(3.8.2)與一個新的Swift 3項目(XCode版本8.2.1(8C1002))一起使用,並且以下代碼在UICollectionViewController中可以正常編譯:

    override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
      ...
      cell.customImageView.sd_setImage(with: imageURL, completed:{
        (SDWebImageCompletionBlock) in

      })
      ...
    }

我已經將SDWebImage導入了swift文件的頂部。 customImageView是在自定義UICollectionViewCell中定義的UIImageView

@IBOutlet weak var customImageView: UIImageView!

但是,這在運行時崩潰,並顯示以下錯誤:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIImageView sd_setImageWithURL:completed:]: unrecognized selector sent to instance ...'

有什么想法為什么可以編譯但在運行時崩潰?

在構建設置中將$(inherited)添加到“其他鏈接器標志”

檢查插座,斷開並重新連接imageView的插座

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM