AsyncDisplayKit icon indicating copy to clipboard operation
AsyncDisplayKit copied to clipboard

Unexpected «Supplementary node should exist» after footer appeared

Open pilot34 opened this issue 10 years ago • 8 comments

I modified your example with cats a bit: showing supplementary footer only when data loaded. After that example is crashing after [ASCollectionView reloadData].

Archived example is here: CatDealsCollectionView.zip

If I comment this assert - everything works fine I think.

pilot34 avatar Feb 17 '16 18:02 pilot34

+1 I am getting this same error. Also working off an example project (but the CustomCollectionView one) and essentially just trying to port it to Swift. I get the error before any explicit calls to reloadData, just after adding the ASCollectionView to my main UIViewController. The obvious (to me) ways to disable supplementary views altogether don't seem to make a difference either.

someone29926 avatar Mar 07 '16 18:03 someone29926

This looks like the same issue as #1771 and what PR #1773 is trying to fix.

@someone29926 @pilot34: could you try out PR #1773 and let us know if this fixes the problem?

hannahmbanana avatar Jun 22 '16 03:06 hannahmbanana

No, I forked that branch and tested my example but have the same error:

- (void)appendMoreItems:(NSInteger)numberOfNewItems completion:(void (^)(BOOL))completion {
  NSArray *newData = [self getMoreData:numberOfNewItems];
  dispatch_async(dispatch_get_main_queue(), ^{
    [_data addObjectsFromArray:newData];
    [_collectionView reloadData];
  });
}

Error: Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Supplementary node should exist.

I pushed this branch here: https://github.com/pilot34/AsyncDisplayKit/tree/test_issue_1238

You can run examples/CatDealsCollectionView and get this crash.

pilot34 avatar Jun 22 '16 21:06 pilot34

@pilot34: Thanks for trying out the PR and reporting back to us! @Adlai-Holler is planning on investigating supplementary nodes in the next few days. Hopefully he will have a fix for you soon.

hannahmbanana avatar Jun 24 '16 07:06 hannahmbanana

@pilot34 thanks for all the details here, including trying out the PR, and sharing your test case. It is extremely valuable and appreciated.

We just landed #1773, but I have opened a detailed task in our internal bug tracker Ship for @Adlai-Holler to continue his thrash tester implementation and audit of this code. We should have a fix in the next ~2 weeks.

appleguy avatar Jul 10 '16 05:07 appleguy

Same behavior in the Swift Corner. Issue happens when you are trying go enable and disable conditional footer and header views in ASCollectionView.

Temporary Fix:

public func collectionView(collectionView: ASCollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForFooterInSection section: Int) -> CGSize
{
        if section == sectionUsers && searchedUsers.count > 0 {
            return CGSize(width: collectionView.bounds.width, height: 30.0);
        }
        return CGSize(width: collectionView.bounds.width, height: 0.1);
}

Set the height to 0.1 instead of CGSizeZero. Everything is working if you can live with this dirty hack.

CR34L avatar Jul 13 '16 16:07 CR34L

@CR34L Dang, I hope I can work on this soon. Nice find on the workaround for the time being.

Adlai-Holler avatar Jul 13 '16 16:07 Adlai-Holler

This issue was moved to TextureGroup/Texture#123

garrettmoon avatar May 01 '17 20:05 garrettmoon