TextureGroup / Texture

Smooth asynchronous user interfaces for iOS apps.
https://texturegroup.org/
Other
8k stars 1.29k forks source link

Unexpected «Supplementary node should exist» after footer appeared #123

Open garrettmoon opened 7 years ago

garrettmoon commented 7 years ago

From @pilot34 on February 17, 2016 18:10

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.

Copied from original issue: facebookarchive/AsyncDisplayKit#1238

garrettmoon commented 7 years ago

From @someone29926 on March 7, 2016 18:46

+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.

garrettmoon commented 7 years ago

From @hannahmbanana on June 22, 2016 3:42

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?

garrettmoon commented 7 years ago

From @pilot34 on June 22, 2016 21:52

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.

garrettmoon commented 7 years ago

From @hannahmbanana on June 24, 2016 7:37

@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.

garrettmoon commented 7 years ago

From @appleguy on July 10, 2016 5:53

@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.

garrettmoon commented 7 years ago

From @CR34L on July 13, 2016 16:19

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.

garrettmoon commented 7 years ago

From @Adlai-Holler on July 13, 2016 16:34

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