SoySauceLab / CollectionKit

Reimagining UICollectionView
MIT License
4.4k stars 259 forks source link

UI API called on a background thread #126

Open ebeland opened 5 years ago

ebeland commented 5 years ago

I'm not sure if this error is unique to our apps use of collectionKit with multiple threads and Scenekit or an issue in the project, I don't have time to fully research it at the moment.

If someone with a more vanilla implementation is getting this error it is an issue.

"Main Thread Checker: UI API called on a background thread: -[UIScrollView setNeedsLayout]"

It occurs on line 83 of collectionView.Swift

public func setNeedsReload() { needsReload = true setNeedsLayout() }

Easily fixed by going back to the main thread.

public func setNeedsReload() { needsReload = true DispatchQueue.main.async { self.setNeedsLayout() } }

casperzandbergenyaacomm commented 5 years ago

I think the problem is that you called setNeedsReload() from a background thread.