Iglistkit: Negative sizes are not supported in the flow layout

Created on 18 Sep 2017  路  5Comments  路  Source: Instagram/IGListKit

Anyone getting this?

2017-09-18 13:03:20.858336+0200 x[22546:24970379] * Assertion failure in -[UICollectionViewFlowLayout _getSizingInfosWithExistingSizingDictionary:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3694.4.18/UICollectionViewFlowLayout.m:1415
2017-09-18 13:03:20.864544+0200 x[22546:24970379]
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'negative sizes are not supported in the flow layout'
First throw call stack:
(
0 CoreFoundation 0x00000001160e81cb __exceptionPreprocess + 171
1 libobjc.A.dylib 0x0000000111885f41 objc_exception_throw + 48
2 CoreFoundation 0x00000001160ed362 +[NSException raise:format:arguments:] + 98
3 Foundation 0x000000011132a089 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 193
4 UIKit 0x0000000113931758 -[UICollectionViewFlowLayout _getSizingInfosWithExistingSizingDictionary:] + 3370
5 UIKit 0x0000000113932ff8 -[UICollectionViewFlowLayout _fetchItemsInfoForRect:] + 136
6 UIKit 0x000000011392b9bf -[UICollectionViewFlowLayout prepareLayout] + 272
7 UIKit 0x0000000113958167 -[UICollectionViewData _prepareToLoadData] + 156
8 UIKit 0x00000001138fee0a -[UICollectionView _endItemAnimationsWithInvalidationContext:tentativelyForReordering:animator:] + 12822
9 UIKit 0x00000001139085ad -[UICollectionView _endUpdatesWithInvalidationContext:tentativelyForReordering:animator:] + 71
10 UIKit 0x00000001139088f2 -[UICollectionView _performBatchUpdates:completion:invalidationContext:tentativelyForReordering:animator:] + 435
11 UIKit 0x000000011390871c -[UICollectionView _performBatchUpdates:completion:invalidationContext:tentativelyForReordering:] + 91
12 UIKit 0x000000011390869e -[UICollectionView _performBatchUpdates:completion:invalidationContext:] + 74
13 UIKit 0x00000001139085f3 -[UICollectionView performBatchUpdates:completion:] + 53
**> 14 IGListKit 0x0000000110e6c673 __62-[IGListAdapterUpdater performBatchUpdatesWithCollectionView:]_block_invoke.118 + 499
15 IGListKit 0x0000000110e6aefe -[IGListAdapterUpdater performBatchUpdatesWithCollectionView:] + 3742
16 IGListKit 0x0000000110e6ec37 __54-[IGListAdapterUpdater queueUpdateWithCollectionView:]_block_invoke + 359

17 libdispatch.dylib 0x00000001171213f7 _dispatch_call_block_and_release + 12
18 libdispatch.dylib 0x000000011712243c _dispatch_client_callout + 8
19 libdispatch.dylib 0x000000011712d6f0 _dispatch_main_queue_callback_4CF + 628
20 CoreFoundation 0x00000001160aaef9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
21 CoreFoundation 0x000000011606f662 __CFRunLoopRun + 2402
22 CoreFoundation 0x000000011606ea89 CFRunLoopRunSpecific + 409
23 GraphicsServices 0x000000011a83b9c6 GSEventRunModal + 62
24 UIKit 0x0000000112e2ed30 UIApplicationMain + 159
25 x 0x00000001101235e7 main + 55
26 libdyld.dylib 0x000000011719ed81 start + 1
)
libc++abi.d

terminating with uncaught exception of type NSException

General information

  • IGListKit version: 3.1.1
  • iOS version(s): 11 GM
  • Xcode version: 9 GM
question

Most helpful comment

@CocoaPriest @rnystrom I've got the same crash and found the reason for it. You are probably returning NaN from (CGSize)sizeForItemAtIndex:(NSInteger)index. The assert in IGListAdapter doesn't help in this case. You have to check if the returned size contains NaN with isnan(x).

All 5 comments

@CocoaPriest why would a size ever be negative? This assert is inside UICollectionViewFlowLayout, something that we cannot control. Also you should be hitting an assert in IGListAdapter if a size is negative.

Sent with GitHawk

Closing out b/c this isn't an issue w/ IGListKit, and IMO not an issue with UICollectionViewFlowLayout. Negative sizes shouldn't be used in general.

@CocoaPriest @rnystrom I've got the same crash and found the reason for it. You are probably returning NaN from (CGSize)sizeForItemAtIndex:(NSInteger)index. The assert in IGListAdapter doesn't help in this case. You have to check if the returned size contains NaN with isnan(x).

@svara mind opening an issue for this? Would be a great addition to the assert.

Sent with GitHawk

@rnystrom Sure thing.

Was this page helpful?
0 / 5 - 0 ratings