Error: terminating with uncaught exception of type NSException

hello ,

i try to add a collection view and when i run i get Thread 1: signal SIGABRT Error.

in the build line i get libc++abi.dylib: terminating with uncaught exception of type NSException

i think the problme its from my connct from the collection view to the View controller by delegate and dataSource thet i connect.

what i need to do dor fix it ?

thanks,

yeseg13

Please, first explain precisely what you did, how you connected all this.


First, are you sure you have a valid connection from the object in IB to its IBOutlet. That's pretty often the cause of such problems.

To correct :

- Remove the connection, in IB (control-click on the collection view and click the x sign in front of the IBOutlet name)

- recreate the connection

- do an option clean on build folder (Project menu with option pressed)

first of all thanks !

i try to do your solution but its dosnt work ,that the log i get after i run the system.

2018-02-20 12:40:30.194465+0200 Alpha[2800:598219] *** Assertion failure in -[UICollectionView _dequeueReusableViewOfKind:withIdentifier:forIndexPath:viewCategory:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3698.51/UICollectionView.m:5283
2018-02-20 12:40:30.201465+0200 Alpha[2800:598219] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'could not dequeue a view of kind: UICollectionElementKindCell with identifier cell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard'
*** First throw call stack:
...
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)


can i add a link to my git project and maybe get some help ?

The message on line 2 seems pretty clear here. I think you might have better luck working through the documentation on how collection view reusable cells work. Check out the Registering Your Cells and Supplementary Views section of Collection View Programming Guide for iOS.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

You need to register your nib, with statement similar to thuis one (this is for a tableView cell, but is is the same principle for collection view:


        let nib = UINib(nibName: "IDCell", bundle: nil)   /
        tableView.register(nib, forCellReuseIdentifier:"IDCell")
Error: terminating with uncaught exception of type NSException
 
 
Q