Swift index 0 beyond bounds for empty array in tableview

前端 未结 1 472
失恋的感觉
失恋的感觉 2021-01-14 13:10

I\'m trying to populate tableview with parse with 2 labels connected to the the main tv controller with PFTableViewCell

when I add the (numberOfSectionsInTableView +

1条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-14 13:54

    Looking at the documentation for PFQueryTableViewController, https://www.parse.com/docs/ios/api/Classes/PFQueryTableViewController.html it looks like you shouldn't be overriding those two methods.

    – tableView:cellForRowAtIndexPath:object: should be called already for all the rows in your table based on your objects. You shouldn't override numberOfSectionsInTableView and numberOfRowsInSection because the Parse controller handles all of that for you. You are overriding these methods and hardcoding a number which causes Parse to try to fetch and object for a row that is out of bounds (it doesn't exist). It looks like there are actually no objects in your datasource.

    0 讨论(0)
提交回复
热议问题