gpt4 book ai didi

iphone - 使NSRangeException越界崩溃

转载 作者:行者123 更新时间:2023-12-03 17:44:32 26 4
gpt4 key购买 nike

我有此代码因错误*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSArray objectAtIndex:]: index 0 beyond bounds for empty array'而崩溃

在这一行:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
MyObject *myCode = [self.fetchedResultsController objectAtIndexPath:indexPath];
}

我看不到这里有什么问题,它是从读取中提取数据。

最佳答案

答案就在您的'reason: ' ... index 0 beyond bounds for empty array'帖子中。您的self.fetchedResultsController为空,现在您需要调查原因。

注意:每次修改表 View 的基础数据时,都需要通过调用-[UITableView reloadData];beginUpdatesendUpdates方法,然后添加或删除正确的索引路径来更新更改。

关于iphone - 使NSRangeException越界崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7340165/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com