取消内容编辑输入请求

时间:2015-06-25 14:10:52

标签: ios download request cancellation photosframework

在我的应用程序中,当您下载contentEditingInput时,用户可以选择新资产,因此我在尝试开始新请求之前尝试终止之前的请求。遗憾的是cancelContentEditingInputRequest:无法正常工作,我仍然可以获得进度,并且在下载完成时会触发完成块。 self.assetself.requestId具有预期值。从iCloud下载资产时出现问题。我是否以错误的方式使用API​​?

if(self.requestId) {
    [self.asset cancelContentEditingInputRequest:self.requestId];
}

PHContentEditingInputRequestOptions *options = [PHContentEditingInputRequestOptions new];
options.networkAccessAllowed = YES;
options.progressHandler = ^(double progress, BOOL *stop) {
    // update UI
};

self.asset = newAsset;
self.requestId = [self.asset requestContentEditingInputWithOptions:options completionHandler:^(PHContentEditingInput *contentEditingInput, NSDictionary *info) {
    self.requestId = 0;

    // handle content editing input
}];

1 个答案:

答案 0 :(得分:0)

我说错了。我以错误的方式使用API​​。 cancelContentEditingInputRequest:用于取消从设备上的资产准备 contentEditingInput 。要取消从iCloud下载,应使用:

options.progressHandler = ^(double progress, BOOL *stop) {
   *stop = YES;
};

如果API合乎逻辑,那么这是一个不同的主题......