gpt4 book ai didi

reactive-cocoa - 如何从 sendError : on RACSignal 映射错误

转载 作者:行者123 更新时间:2023-12-05 08:58:38 27 4
gpt4 key购买 nike

这很麻烦

RACSignal *originalSignal = ...;

RACSignal *mappedSignal = [[[[[originalSignal publish] autoconnect] materialize] map:^id(RACEvent *event) {
if(event.eventType == RACEventTypeError)
{
return [RACEvent eventWithError:[self errorForHelperError:event.error]];
}
return event;
}] dematerialize];

最佳答案

-catch: 让你更优雅地处理这个问题:

RACSignal *mappedSignal = [originalSignal catch:^(NSError *error) {
return [RACSignal error:[self errorForHelperError:error]];
}];

关于reactive-cocoa - 如何从 sendError : on RACSignal 映射错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21625798/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com