[ASDKgram Example] fix crash on startup (#566)

* fix crash on ASDKgram startup

* quicker fix
This commit is contained in:
Hannah Troisi
2017-09-16 10:36:58 -07:00
committed by appleguy
parent b9b2d7e3ca
commit dcaca529b4

View File

@@ -59,7 +59,7 @@
[_activityIndicatorView stopAnimating];
[self insertNewRows:newPhotos];
[self.tableView reloadData];
[self requestCommentsForPhotos:newPhotos];
// immediately start second larger fetch
@@ -74,7 +74,8 @@
NSMutableArray *indexPaths = [NSMutableArray array];
NSInteger newTotalNumberOfPhotos = [_photoFeed numberOfItemsInFeed];
for (NSInteger row = newTotalNumberOfPhotos - newPhotos.count; row < newTotalNumberOfPhotos; row++) {
NSInteger existingNumberOfPhotos = newTotalNumberOfPhotos - newPhotos.count;
for (NSInteger row = existingNumberOfPhotos; row < newTotalNumberOfPhotos; row++) {
NSIndexPath *path = [NSIndexPath indexPathForRow:row inSection:section];
[indexPaths addObject:path];
}