2012-04-24 2 views
1

Я внедренный в моем проекте EGOTableViewPullRefresh, все работает и обновляется нормально, но когда я тяну взгляд вниз слишком много, чтобы обновить, приложение падает с ошибкой:EGOTableViewPullRefresh сбой при чрезмерно отпуская вид

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"]; 

UPDATE

- (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; 
} 

Вы можете помочь мне с этим?

+0

Я не вижу никакого массива здесь. Итак, вы рушитесь где-то еще ... Посмотрите, где вы получаете доступ к массиву в вашем коде. Поскольку вы упоминаете EGOTableVIew, я бы предположил, что вы являетесь crashin в функции datasource cellForRowAtIndexPath tableview, которая имеет значение – Lefteris

+0

, вы имеете в виду это? см. обновленный код –

+0

Я добавил еще код –

ответ

0

Я нашел решение. Когда я позвонил rssParser в reloadTableViewDataSource сбой. Когда я попытался позвонить rssParser в dataSourceDidFinishLoadingNewData все работает нормально без сбоев.

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

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