Retrying RACObserve until success

81 views Asked by At

I have RACObserve block and I want to retry calling until it is successfully returns. So it won't show the Error message, but it will retry to fetch. Thanks for help!

    [[[[RACObserve(self, currentLocation)
        ignore:nil]

       flattenMap:^(CLLocation *newLocation) {
           return [RACSignal merge:@[
                                     [self updateCurrentConditions],
                                     [self updateDailyForecast],
                                     [self updateHourlyForecast]
                                     ]];

       }] deliverOn:RACScheduler.mainThreadScheduler]

     subscribeError:^(NSError *error) {
         [TSMessage showNotificationWithTitle:@"Error"
                                     subtitle:@"There was a problem fetching the latest weather."
                                         type:TSMessageNotificationTypeError];
     }];
1

There are 1 answers

0
Charles Maria On BEST ANSWER

Use the method retry at the last point in the call chain before subscription.