【发布时间】:2015-09-13 00:31:42
【问题描述】:
我正在尝试使我的代码更具功能性和反应性。我创建一个这样的请求:
[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 请求,我必须在 progressHandler 中设置 *stop = YES;。如何以被动的方式做到这一点?
【问题讨论】:
标签: ios functional-programming reactive-cocoa cancellation photosframework