appname.ViewsVC collectionView:cellForItemAtIndexPath:]:无法识别的选择器发送到实例

use*_*705 6 ios parse-platform uicollectionview uicollectionviewcell

我正在构建一个集合视图,并收到以下错误.

由于未捕获的异常'NSInvalidArgumentException'终止应用程序,原因:' - [appname.ViewsVC collectionView:cellForItemAtIndexPath:]:发送到实例的无法识别的选择器

这是我自定义单元格的代码

// cell configuration
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell{

    let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "ViewsCell", for: indexPath) as! ViewsCell

    cell.fullnameLbl.text = self.viewsArray[(indexPath as NSIndexPath).row].capitalizeEachWord

    // pic setup
    avaArray[indexPath.row].getDataInBackground { (data:Data?, error:Error?) in
        if error == nil {
            cell.avaImg.image = UIImage(data: data!)
        }
    }

    return cell
}
Run Code Online (Sandbox Code Playgroud)

我在故事板中创建了集合视图和单元格,并为它们提供了正确的标识符.我还将UIimageView和标签连接到单元类.

任何想法可能是错的.

use*_*705 22

我意识到我在View控制器的顶部缺少UICollectionViewDataSource和UICollectionViewDelegate

class ViewsVC: UIViewController, UICollectionViewDataSource, UICollectionViewDelegate {