Application Got Crash in IOS 18 device

Can anyone help me to resolve this issue?

I have two collectionviews in a tableview and each time you try to scroll the collecctionview after clicking a cell, it crashes with the following error:

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Expected dequeued view to be returned to the collection view in preparation for display. When the collection view's data source is asked to provide a view for a given index path, ensure that a single view is dequeued and returned to the collection view. Avoid dequeuing views without a request from the collection view. For retrieving an existing view in the collection view, use -[UICollectionView cellForItemAtIndexPath:] or -[UICollectionView supplementaryViewForElementKind:atIndexPath:]

Hello karthickaitech, Check if you're calling dequereusabelCell in a place OTHER THAN cellForRowAt/ cellForItemAt. IOS 18 doesn't like that check this also: https://forums.developer.apple.com/forums/thread/756645

my case to fix commit temporary code colletionview in method

func collectionView(_ collectionView: UICollectionView, willDisplay cell: UICollectionViewCell, forItemAt indexPath: IndexPath)

after run it will work perfectly.

Application Got Crash in IOS 18 device
 
 
Q