diff --git a/examples/ASDKgram/Sample/PhotoFeedSectionController.m b/examples/ASDKgram/Sample/PhotoFeedSectionController.m index a9343dc01f..963eba95df 100644 --- a/examples/ASDKgram/Sample/PhotoFeedSectionController.m +++ b/examples/ASDKgram/Sample/PhotoFeedSectionController.m @@ -69,18 +69,20 @@ ASIGSectionControllerCellForIndexImplementation; - (void)beginBatchFetchWithContext:(ASBatchContext *)context { - // Immediately add the loading spinner if needed. - if (self.items.count > 0) { - NSArray *newItems = [self.items arrayByAddingObject:_paginatingSpinner]; - [self setItems:newItems animated:NO completion:nil]; - } + dispatch_async(dispatch_get_main_queue(), ^{ + // Immediately add the loading spinner if needed. + if (self.items.count > 0) { + NSArray *newItems = [self.items arrayByAddingObject:_paginatingSpinner]; + [self setItems:newItems animated:NO completion:nil]; + } - // Start the fetch, then update the items (removing the spinner) when they are loaded. - [_photoFeed requestPageWithCompletionBlock:^(NSArray *newPhotos){ - [self setItems:_photoFeed.photos animated:NO completion:^{ - [context completeBatchFetching:YES]; - }]; - } numResultsToReturn:20]; + // Start the fetch, then update the items (removing the spinner) when they are loaded. + [_photoFeed requestPageWithCompletionBlock:^(NSArray *newPhotos){ + [self setItems:_photoFeed.photos animated:NO completion:^{ + [context completeBatchFetching:YES]; + }]; + } numResultsToReturn:20]; + }); } #pragma mark - RefreshingSectionControllerType