ios - UIrefreshcontrol with an asynchronous request -


i have tableview need implement uirefreshcontroller. works fine. want when pull , refresh, needs request again. @ moment there issue when remove fixtures objects, if don't add same fixtures there.

what doing wrong?

[self firstrequest]; //is request 

the code:

-(void)viewdidappear:(bool)animated {      uirefreshcontrol *refreshcontrol = [[uirefreshcontrol alloc] init];     [refreshcontrol addtarget:self action:@selector(refresh:)  forcontrolevents:uicontroleventvaluechanged];     [self.thetableview addsubview:refreshcontrol]; }  - (void)refresh:(uirefreshcontrol *)refreshcontrol {         [fixtures removeallobjects];      [self firstrequest];     [refreshcontrol endrefreshing]; } 

the problem everytime reload add duplicates , when use

       [fixtures removeallobjects]; 

it gives me following error:

  terminating app due uncaught exception 'nsrangeexception', reason: '*** -[__nsarrayi objectatindex:]: index 3 beyond bounds empty array' 


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -