Viraj Padsala
Viraj Padsala

Reputation: 1398

Pull to refresh Crash my application

I have an Application, that takes Restaurants from shared Google Api and displays it in a table view.Then i use

Carbon-kit

for pull to refresh content of tableview

    refresh = [[CarbonSwipeRefresh alloc] initWithScrollView:self.tblRest];
    //[refresh setMarginTop:120];
    [refresh setColors:@[[UIColor blueColor], [UIColor redColor], [UIColor orangeColor], [UIColor greenColor]]];
    [self.view addSubview:refresh];

    [refresh addTarget:self action:@selector(pullToRefresh:) forControlEvents:UIControlEventValueChanged];

When i scroll my table and try to refresh it, It gives me below error:-

Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 2 beyond bounds for empty array'

please help me for this error. Thanking you in advance.

Upvotes: 2

Views: 927

Answers (1)

Fahim Parkar
Fahim Parkar

Reputation: 31647

This is happening because you must be initializing your array again while refreshing.

Upvotes: 3

Related Questions