I am facing this error "exc_bad_instruction (code=exc_i386_invop subcode=0x0)"

239 Views Asked by At

I am running the following code and getting error in swift.

func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
     let cell = Collection_View.dequeueReusableCell(withReuseIdentifier: "list", for: indexPath) as! List_CollectionViewCell
     cell.list_name.text = items[indexPath.row]
     **cell.created_date.text = c_date[indexPath.row]**
     return cell
}

why is xcode generating this error on this line?

1

There are 1 best solutions below

0
ielyamani On

This error arises when there is a failed force unwrapping. Make sure that the class of the prototype in your storyboard is set to List_CollectionViewCell in the Identity Inspector:

class

and that its identifier is "list" in the Attributes inspector:

identifier