重试RACObserve直到成功

时间:2016-02-15 05:59:47

标签: ios xcode reactive-cocoa racsignal

我有RACObserve块,我想重试呼叫,直到它成功返回。因此它不会显示错误消息,但会重试提取。 谢谢你的帮助!

    [[[[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 个答案:

答案 0 :(得分:1)

在订阅之前,在调用链的最后一点使用方法retry