在我的cellForRowAtIndexPath方法中,它从服务器获取数据。如果数据的值之一是false,我想更改一些全局对象的值,跳过实现这个单元格,但是当我尝试返回nil时,应用程序会崩溃。我使用Parse.com PFQueryTableViewController作为UITableViewController,所以在设置事物的方式下,它获取所有的数据,然后通过调用cellForRowAtIndexPath来遍历它。我不能查询对上述值是正确的对象,因为当它是false时,我需要在我的程序中更改其他内容。
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>)'发布于 2016-01-23 02:02:58
您不能返回零的cellForRowAtIndexPath,这将使您的应用程序崩溃。您只需返回一个单元格,而不需要任何元素,如:return [UITableViewCell new];
嗯,在我看来,你最好重新排列你的数据源数组,只需选择‘真’到一个新的数组。使用新数组将修复您的情况。
https://stackoverflow.com/questions/34958722
复制相似问题