开始下载文件后,如何停止下载文件?我启动这样的下载:
[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"];
这是我下载文件的代码段,但不知道如何在启动后停止下载文件。
答案 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];