gpt4 book ai didi

iphone - 过度释放 View 时 EGOTableViewPullRefresh 崩溃

转载 作者:行者123 更新时间:2023-11-28 17:34:13 25 4
gpt4 key购买 nike

我嵌入到我的项目 EGOTableViewPullRefresh 中,一切正常并且更新正常,但是当我将 View 下拉太多无法更新时,应用程序崩溃并出现错误:

2012-04-24 19:02:56.670 Test [3927: f803] * Terminating app due to uncaught exception 'NSRangeException', reason: '* - [__NSArrayM objectAtIndex:]: index 2 beyond bounds for empty array' * First throw call stack:

这段代码

self.tabBarController = [[[UITabBarController alloc] init] autorelease];
NSMutableArray * viewControllers = [[NSMutableArray alloc] init];


//plist file full path
NSString *urlStr = [[NSString alloc]
initWithFormat:@"http://www.test.com/data.xml?seedVar=%f",
(float)random()/RAND_MAX];
NSURL *url = [NSURL URLWithString:urlStr];
NSDictionary *dict = [[NSDictionary alloc] initWithContentsOfURL:url];

//Get the folder array
NSArray * subscriptionFolders = [dict objectForKey:@"Folders"];

更新

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *CellIdentifier = @"Cell";

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
[cell.textLabel setNumberOfLines:2];
[cell.detailTextLabel setNumberOfLines:3];
[cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator];
}

RSSItem * rssItem = (RSSItem *)[_rssParser.rssItems objectAtIndex:indexPath.row];
[cell.textLabel setText:rssItem.title];
[cell.detailTextLabel setText:rssItem.summary];

return cell;
}

你能帮我吗?

最佳答案

我找到了解决方案。当我在 reloadTableViewDataSource 中调用 rssParser 时,它崩溃了。当我尝试在 dataSourceDidFinishLoadingNewData 中调用 rssParser 时,一切正常,没有崩溃。

- (void)reloadTableViewDataSource{
[super performSelector:@selector(dataSourceDidFinishLoadingNewData) withObject:nil afterDelay:2.0];
}

- (void)dataSourceDidFinishLoadingNewData{
[_rssParser start];
[refreshHeaderView setCurrentDate];
[super dataSourceDidFinishLoadingNewData];
}

关于iphone - 过度释放 View 时 EGOTableViewPullRefresh 崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10301846/

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