Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.

Commit 80cc0e6

Browse files
committed
Merge pull request #482 from facebook/DisableAsyncDataFetching
Disable asyncDataFetching in ASTableView and ASCollectionView init
2 parents a4a03fd + ba5a6e1 commit 80cc0e6

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

AsyncDisplayKit/ASCollectionView.mm

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,10 @@ - (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionVi
136136
{
137137
if (!(self = [super initWithFrame:frame collectionViewLayout:layout]))
138138
return nil;
139+
140+
// FIXME: asyncDataFetching is currently unreliable for some use cases.
141+
// https://github.com/facebook/AsyncDisplayKit/issues/385
142+
asyncDataFetchingEnabled = NO;
139143

140144
ASDisplayNodeAssert([layout isKindOfClass:UICollectionViewFlowLayout.class], @"only flow layouts are currently supported");
141145

@@ -165,8 +169,10 @@ - (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionVi
165169
return self;
166170
}
167171

168-
-(void)dealloc {
169-
// a little defense move here.
172+
- (void)dealloc
173+
{
174+
// Sometimes the UIKit classes can call back to their delegate even during deallocation.
175+
// This bug might be iOS 7-specific.
170176
super.delegate = nil;
171177
super.dataSource = nil;
172178
}

AsyncDisplayKit/ASTableView.mm

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,8 @@ void ASPerformBlockWithoutAnimation(BOOL withoutAnimation, void (^block)()) {
157157
#pragma mark -
158158
#pragma mark Lifecycle
159159

160-
- (void)configureWithAsyncDataFetching:(BOOL)asyncDataFetchingEnabled {
160+
- (void)configureWithAsyncDataFetching:(BOOL)asyncDataFetchingEnabled
161+
{
161162
_layoutController = [[ASFlowLayoutController alloc] initWithScrollOption:ASFlowLayoutDirectionVertical];
162163

163164
_rangeController = [[ASRangeController alloc] init];
@@ -185,12 +186,17 @@ - (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style asyncD
185186
if (!(self = [super initWithFrame:frame style:style]))
186187
return nil;
187188

189+
// FIXME: asyncDataFetching is currently unreliable for some use cases.
190+
// https://github.com/facebook/AsyncDisplayKit/issues/385
191+
asyncDataFetchingEnabled = NO;
192+
188193
[self configureWithAsyncDataFetching:asyncDataFetchingEnabled];
189194

190195
return self;
191196
}
192197

193-
- (instancetype)initWithCoder:(NSCoder *)aDecoder {
198+
- (instancetype)initWithCoder:(NSCoder *)aDecoder
199+
{
194200
if (!(self = [super initWithCoder:aDecoder]))
195201
return nil;
196202

@@ -199,8 +205,10 @@ - (instancetype)initWithCoder:(NSCoder *)aDecoder {
199205
return self;
200206
}
201207

202-
-(void)dealloc {
203-
// a little defense move here.
208+
- (void)dealloc
209+
{
210+
// Sometimes the UIKit classes can call back to their delegate even during deallocation.
211+
// This bug might be iOS 7-specific.
204212
super.delegate = nil;
205213
super.dataSource = nil;
206214
}

0 commit comments

Comments
 (0)