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

时间:2016-12-31 17:13:43

标签: ios swift swift3 sdwebimage

我使用带有SDWebImage(3.8.2)的CocoaPods和一个新的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

      })
      ...
    }

我已经在swift文件的顶部导入了SDWebImage。 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 ...'

为什么这个编译很好但在运行时崩溃的任何想法?

1 个答案:

答案 0 :(得分:0)

在构建设置

中将 val p=Runtime.getRuntime().exec("C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -windowstyle hidden C:\\Hadoop\\Hadoop-2.3\\sbin\\start-dfs.cmd -verb RunAs") 添加到“其他链接标记”