apptekstudios / ASCollectionView

A SwiftUI collection view with support for custom layouts, preloading, and more.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

IOS16: NSInternalInconsistencyException: UICollectionViewLayoutAttributes: -setSize: requires finite dimensions

dreampowder opened this issue · comments

Hello, first of all, thanks a lot for this wonderful library.

From time to time, i see a random crash log in crashlytics, which i couldn't reproduce on my side whatever i do.

Fatal Exception: NSInternalInconsistencyException
UICollectionViewLayoutAttributes: -setSize: requires finite dimensions <UICollectionViewLayoutAttributes: 0x14b2c0140> index path: (1-0); element kind: (groupBackground); frame = (0 377.667; 390 294.333); alpha = 0; - {inf, inf}

the groupBackground is registered like this:

    var collectionViewLayouts:ASCollectionLayout<SeasonScreenSections>{
        let layout =  ASCollectionLayout<SeasonScreenSections>(scrollDirection: .vertical, interSectionSpacing: 0.0,layoutPerSection: {sectionId in
            switch(sectionId){
            case .beatpacks:
                return SeasonLayoutGenerator.beatpackLayout(columnCount: 2)
            case .spotlight:
                return SeasonLayoutGenerator.beatpackLayout(columnCount: 1)
            case .creators:
                return SeasonLayoutGenerator.creatorLayout()
            case .season_header:
                return SeasonLayoutGenerator.seasonHeaderLayout(height: seasonImgHeight ?? 0)
            }
        }).decorationView(GroupBackground.self, forDecorationViewOfKind: "groupBackground")
        return layout
    }

and GroupBackground is like this:

struct GroupBackground: View, Decoration
{
    var body: some View
    {
        Color.gray
    }
}

Thanks a lot for your time.

looks like this is an ios16 bug, similar to the tableview bug mentioned in another issue
Screen Shot 2022-07-19 at 16 52 02
Screen Shot 2022-07-19 at 16 51 50