0

开始下载文件后,如何停止下载文件?我像这样启动下载:

[docDirSkyDRive  appendString:[NSString stringWithFormat:@"/%@ ",[[FilesFromSkyDrive objectAtIndex:indexPath] objectForKey:@"name"]]];
NSMutableString *downloadPath=[[NSMutableString alloc]init];
[downloadPath appendFormat:@"%@/content",[[FilesFromSkyDrive objectAtIndex:indexPath] objectForKey:@"id"]];
[self.liveClient downloadFromPath:downloadPath delegate:self userState:@"download"];

这是我下载文件的代码片段,但不知道一旦开始下载文件如何停止。

4

1 回答 1

1

尝试这样做

[docDirSkyDRive  appendString:[NSString stringWithFormat:@"/%@ ",[[FilesFromSkyDrive    objectAtIndex:indexPath] objectForKey:@"name"]]];
NSMutableString *downloadPath=[[NSMutableString alloc]init];
[downloadPath appendFormat:@"%@/content",[[FilesFromSkyDrive objectAtIndex:indexPath] objectForKey:@"id"]];
LiveOperation *opperation = [self.liveClient downloadFromPath:downloadPath delegate:self userState:@"download"];

那么您可以使用取消此操作[opperation cancel];

于 2014-03-12T09:50:17.757 回答