From ba5a6e15c0928c0bf6dafcf04f94fb603388dac7 Mon Sep 17 00:00:00 2001 From: Scott Goodson Date: Sun, 14 Jun 2015 19:59:39 -0700 Subject: [PATCH] Disable asyncDataFetching in ASTableView and ASCollectionView init methods. It's currently unreliable for some use cases that issue editing calls while content is displayed or being interacted with. The performance gain is not sufficient to sacrifice correctness for the clients that hit this issue, so it will remain off until fully resolved. --- AsyncDisplayKit/ASCollectionView.mm | 10 ++++++++-- AsyncDisplayKit/ASTableView.mm | 16 ++++++++++++---- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/AsyncDisplayKit/ASCollectionView.mm b/AsyncDisplayKit/ASCollectionView.mm index 35a45fc958..377804e038 100644 --- a/AsyncDisplayKit/ASCollectionView.mm +++ b/AsyncDisplayKit/ASCollectionView.mm @@ -136,6 +136,10 @@ static BOOL _isInterceptedSelector(SEL sel) { if (!(self = [super initWithFrame:frame collectionViewLayout:layout])) return nil; + + // FIXME: asyncDataFetching is currently unreliable for some use cases. + // https://github.com/facebook/AsyncDisplayKit/issues/385 + asyncDataFetchingEnabled = NO; ASDisplayNodeAssert([layout isKindOfClass:UICollectionViewFlowLayout.class], @"only flow layouts are currently supported"); @@ -165,8 +169,10 @@ static BOOL _isInterceptedSelector(SEL sel) return self; } --(void)dealloc { - // a little defense move here. +- (void)dealloc +{ + // Sometimes the UIKit classes can call back to their delegate even during deallocation. + // This bug might be iOS 7-specific. super.delegate = nil; super.dataSource = nil; } diff --git a/AsyncDisplayKit/ASTableView.mm b/AsyncDisplayKit/ASTableView.mm index ae54e104cc..2288958d3c 100644 --- a/AsyncDisplayKit/ASTableView.mm +++ b/AsyncDisplayKit/ASTableView.mm @@ -157,7 +157,8 @@ void ASPerformBlockWithoutAnimation(BOOL withoutAnimation, void (^block)()) { #pragma mark - #pragma mark Lifecycle -- (void)configureWithAsyncDataFetching:(BOOL)asyncDataFetchingEnabled { +- (void)configureWithAsyncDataFetching:(BOOL)asyncDataFetchingEnabled +{ _layoutController = [[ASFlowLayoutController alloc] initWithScrollOption:ASFlowLayoutDirectionVertical]; _rangeController = [[ASRangeController alloc] init]; @@ -185,12 +186,17 @@ void ASPerformBlockWithoutAnimation(BOOL withoutAnimation, void (^block)()) { if (!(self = [super initWithFrame:frame style:style])) return nil; + // FIXME: asyncDataFetching is currently unreliable for some use cases. + // https://github.com/facebook/AsyncDisplayKit/issues/385 + asyncDataFetchingEnabled = NO; + [self configureWithAsyncDataFetching:asyncDataFetchingEnabled]; return self; } -- (instancetype)initWithCoder:(NSCoder *)aDecoder { +- (instancetype)initWithCoder:(NSCoder *)aDecoder +{ if (!(self = [super initWithCoder:aDecoder])) return nil; @@ -199,8 +205,10 @@ void ASPerformBlockWithoutAnimation(BOOL withoutAnimation, void (^block)()) { return self; } --(void)dealloc { - // a little defense move here. +- (void)dealloc +{ + // Sometimes the UIKit classes can call back to their delegate even during deallocation. + // This bug might be iOS 7-specific. super.delegate = nil; super.dataSource = nil; }