I'm using a UICollectionViewCompositionalLayout, and an exception is thrown when I load my collection view.
The exception says "Cannot solve for a non-group item."
Any idea what might be wrong? Or how to fix it?
Here's my layout code
func sideBarSectionCollectionLayout()->UICollectionViewCompositionalLayout {
let size = NSCollectionLayoutSize(widthDimension:.fractionalWidth(1), heightDimension:.estimated(105))
let item = NSCollectionLayoutItem(layoutSize: size)
let group = NSCollectionLayoutGroup.horizontal(layoutSize: size, subitems: [item])
let section = NSCollectionLayoutSection(group: group)
section.contentInsets = NSDirectionalEdgeInsets(top: 5, leading: 5, bottom: 5, trailing: 5)
section.interGroupSpacing = 5
return UICollectionViewCompositionalLayout(section: section)
}
My cells are set up in the storyboard.
I'm running xcode 11.1 (11A1027), and catalina 10.15.1 Beta (19B68f)
It started after the catalina upgrade from the GM.
Here's the relevant part of the stack trace.
2019-10-17 04:02:04.556019-0400 SingAccord[4897:254625] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Cannot solve for a non-group item.'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff3ab7ff43 __exceptionPreprocess + 250
1 libobjc.A.dylib 0x00007fff70d23835 objc_exception_throw + 48
2 CoreFoundation 0x00007fff3ab9b800 +[NSException raise:format:arguments:] + 88
3 Foundation 0x00007fff3d27a5d1 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 191
4 UIKitCore 0x00007fff78be85db -[_UICollectionLayoutItemSolver _solveGroup] + 3778
5 UIKitCore 0x00007fff78be7054 -[_UICollectionLayoutItemSolver _solveForContainer:layoutAxis:traitCollection:maxFrameCount:layoutRTL:preferredSizes:solutionRecursionDepth:] + 253
6 UIKitCore 0x00007fff78be59ac -[_UICollectionLayoutItemSolver solveForContainer:layoutAxis:traitCollection:maxFrameCount:layoutRTL:preferredSizes:] + 110
7 UIKitCore 0x00007fff78bf400b __66-[_UICollectionLayoutSectionEstimatedSolver _solveWithParameters:]_block_invoke.195 + 243
8 UIKitCore 0x00007fff78bf24c6 -[_UICollectionLayoutSectionEstimatedSolver _solveWithParameters:] + 2812
9 UIKitCore 0x00007fff78befc94 -[_UICollectionLayoutSectionEstimatedSolver solveForContainer:traitCollection:layoutAxis:frameCount:preferredSizes:layoutRTL:] + 284
10 UIKitCore 0x00007fff78bcdf77 -[_UICollectionCompositionalLayoutSolver _solveWithSectionLayouts:preferredSizesDict:dataSourceSnapshot:update:] + 1491
11 UIKitCore 0x00007fff78bcd98d -[_UICollectionCompositionalLayoutSolver _solve] + 201
12 UIKitCore 0x00007fff78bc42a1 -[_UICollectionCompositionalLayoutSolver initWithContainer:traitCollection:layoutAxis:dataSourceSnapshot:options:sectionProvider:] + 659
13 UIKitCore 0x00007fff78bbff99 -[UICollectionViewCompositionalLayout _fullResolve] + 1216
14 UIKitCore 0x00007fff78bbec6b -[UICollectionViewCompositionalLayout invalidateLayoutWithContext:] + 1387
15 UIKitCore 0x00007fff788238bb -[UICollectionViewLayout _invalidateLayoutUsingContext:] + 56
16 UIKitCore 0x00007fff788237cf -[UICollectionView _invalidateLayoutIfNecessaryForReload] + 155
17 UIKitCore 0x00007fff7882a031 -[UICollectionView reloadData] + 977
18 UIKit 0x00007fff723af328 -[UICollectionViewAccessibility reloadData] + 42