我正在尝试使我的代码更具功能性和反应性。我创建一个这样的请求:
[RACSignal createSignal:^RACDisposable *(id<RACSubscriber> subscriber) {
PHContentEditingInputRequestOptions *options = [PHContentEditingInputRequestOptions new];
options.networkAccessAllowed = YES;
options.progressHandler = ^(double progress, BOOL *stop) {
// update UI
};
[asset requestContentEditingInputWithOptions:options completionHandler:^(PHContentEditingInput *contentEditingInput, NSDictionary *info) {
// subscriber send next/completed/error
}];
return [RACDisposable disposableWithBlock:^{
// here I should kill request if still active
}];
}];
要取消 iCloud 请求,我必须*stop = YES;
在progressHandler
. 如何以反应的方式做到这一点?