In my cellForRowAtIndexPath
method, it's fetching the data from the server. If one of the values of the data is false
I want to change a few values of some global objects and skip implementing this cell, but when I try returning nil
the app crashes. I'm using Parse.com PFQueryTableViewController
for the UITableViewController
, so with the way things are set up it fetches all the data and then goes through it with calls the cellForRowAtIndexPath
. I can't query objects that are true for said-value because when it's false
, I need to change other things in my program.
Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:]
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UITableView (<UITableView: 0x7e30e400; frame = (0 95; 320 424); clipsToBounds = YES; autoresize = W+H; gestureRecognizers = <NSArray: 0x7b2a94b0>; layer = <CALayer: 0x7b2a8af0>; contentOffset: {0, 0}; contentSize: {320, 1690}>) failed to obtain a cell from its dataSource (<_UIFilteredDataSource: 0x7b26d5a0>)'
You can not return nil for cellForRowAtIndexPath which will crash your app.
You can just return a cell without any elements like:
return [UITableViewCell new];
Well, in my opinion you'd better rearrange your datasource array, just pick the 'true' out into a new array. Using the new array will fix your situation.