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
Post a Comment