From 014cf9c500a426cdb789a5cf456cc749e8bca78c Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Mon, 7 Jan 2019 17:57:22 -0700 Subject: [PATCH] fix crash on iOS9 --- .../ConversationView/ConversationViewController.m | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m index ae45b636e..04bffc62f 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m @@ -571,7 +571,11 @@ typedef enum : NSUInteger { self.collectionView.showsVerticalScrollIndicator = YES; self.collectionView.showsHorizontalScrollIndicator = NO; self.collectionView.keyboardDismissMode = UIScrollViewKeyboardDismissModeInteractive; - self.collectionView.prefetchingEnabled = NO; + if (@available(iOS 10, *)) { + // To minimize time to initial apearance, we initially disable prefetching, but then + // re-enable it once the view has appeared. + self.collectionView.prefetchingEnabled = NO; + } [self.view addSubview:self.collectionView]; [self.collectionView autoPinEdgesToSuperviewEdges]; @@ -1148,8 +1152,11 @@ typedef enum : NSUInteger { [self autoLoadMoreIfNecessary]; if (!self.viewHasEverAppeared) { - // Re-enable prefetching. - self.collectionView.prefetchingEnabled = YES; + // To minimize time to initial apearance, we initially disable prefetching, but then + // re-enable it once the view has appeared. + if (@available(iOS 10, *)) { + self.collectionView.prefetchingEnabled = YES; + } // Now that we're using a "minimal" initial load window, // try to increase the load window a moment after we've