Merge pull request #482 from facebook/DisableAsyncDataFetching

Disable asyncDataFetching in ASTableView and ASCollectionView init
This commit is contained in:
appleguy 2015-06-14 20:01:56 -07:00
commit 80cc0e64d0
2 changed files with 20 additions and 6 deletions

View File

@ -137,6 +137,10 @@ static BOOL _isInterceptedSelector(SEL sel)
if (!(self = [super initWithFrame:frame collectionViewLayout:layout])) if (!(self = [super initWithFrame:frame collectionViewLayout:layout]))
return nil; 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"); ASDisplayNodeAssert([layout isKindOfClass:UICollectionViewFlowLayout.class], @"only flow layouts are currently supported");
ASFlowLayoutDirection direction = (((UICollectionViewFlowLayout *)layout).scrollDirection == UICollectionViewScrollDirectionHorizontal) ? ASFlowLayoutDirectionHorizontal : ASFlowLayoutDirectionVertical; ASFlowLayoutDirection direction = (((UICollectionViewFlowLayout *)layout).scrollDirection == UICollectionViewScrollDirectionHorizontal) ? ASFlowLayoutDirectionHorizontal : ASFlowLayoutDirectionVertical;
@ -165,8 +169,10 @@ static BOOL _isInterceptedSelector(SEL sel)
return self; return self;
} }
-(void)dealloc { - (void)dealloc
// a little defense move here. {
// Sometimes the UIKit classes can call back to their delegate even during deallocation.
// This bug might be iOS 7-specific.
super.delegate = nil; super.delegate = nil;
super.dataSource = nil; super.dataSource = nil;
} }

View File

@ -157,7 +157,8 @@ void ASPerformBlockWithoutAnimation(BOOL withoutAnimation, void (^block)()) {
#pragma mark - #pragma mark -
#pragma mark Lifecycle #pragma mark Lifecycle
- (void)configureWithAsyncDataFetching:(BOOL)asyncDataFetchingEnabled { - (void)configureWithAsyncDataFetching:(BOOL)asyncDataFetchingEnabled
{
_layoutController = [[ASFlowLayoutController alloc] initWithScrollOption:ASFlowLayoutDirectionVertical]; _layoutController = [[ASFlowLayoutController alloc] initWithScrollOption:ASFlowLayoutDirectionVertical];
_rangeController = [[ASRangeController alloc] init]; _rangeController = [[ASRangeController alloc] init];
@ -185,12 +186,17 @@ void ASPerformBlockWithoutAnimation(BOOL withoutAnimation, void (^block)()) {
if (!(self = [super initWithFrame:frame style:style])) if (!(self = [super initWithFrame:frame style:style]))
return nil; return nil;
// FIXME: asyncDataFetching is currently unreliable for some use cases.
// https://github.com/facebook/AsyncDisplayKit/issues/385
asyncDataFetchingEnabled = NO;
[self configureWithAsyncDataFetching:asyncDataFetchingEnabled]; [self configureWithAsyncDataFetching:asyncDataFetchingEnabled];
return self; return self;
} }
- (instancetype)initWithCoder:(NSCoder *)aDecoder { - (instancetype)initWithCoder:(NSCoder *)aDecoder
{
if (!(self = [super initWithCoder:aDecoder])) if (!(self = [super initWithCoder:aDecoder]))
return nil; return nil;
@ -199,8 +205,10 @@ void ASPerformBlockWithoutAnimation(BOOL withoutAnimation, void (^block)()) {
return self; return self;
} }
-(void)dealloc { - (void)dealloc
// a little defense move here. {
// Sometimes the UIKit classes can call back to their delegate even during deallocation.
// This bug might be iOS 7-specific.
super.delegate = nil; super.delegate = nil;
super.dataSource = nil; super.dataSource = nil;
} }