nodeIndexWithPage:... is likely executing asynchronously.

It returns before the data is fetched and then your table view methods are hardwired to 5 rows and, thus, the table tries to fill with data that isn't loaded yet.

Have your numberOfRowsInSection: method return [storageData count].

You are already calling -reloadData in the completion block, so the table will automatically refresh on successful load.

Are you also manually declaring instance variables?

If so, then storageData = ... and self.storageData = won't actually set the same thing (unless you also override -storageData and -setStorageData:).

Make everything reference it via self.storageData.

Are you sure you are working with just one instance of the class that displays the data?

I.e. Add NSLog(@"%p", self); to the beginning of viewDidLoad. Hopefully, it only logs once. It should only print one hexadecimal number.

NSLog() always prints something. If it isn't printing anything, then the code isn't being executed.

More Answer related to the Same Query


Your tableView:numberOfRowsInSection: method should return storageData.count instead of a hardcoded 5.

Credit Goes to: stackoverflow.com

Related question with same questions but different answers