如何在Skydrive API中停止下载文件

时间:2013-02-14 11:04:59

标签: objective-c onedrive

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

[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"];

这是我下载文件的代码段,但不知道如何在启动后停止下载文件。

1 个答案:

答案 0 :(得分: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];

取消此操作