您好,我正在从 Google Drive 下载一个 3 MB 的媒体文件。文件在 82 kb 后完成下载。它没有完全下载。我检查了小文件..但是对于任何大小的文件,下载大小保持不变..即 82 kb..
我正在尝试 GTMHTTPFetcher 下载..但出现错误
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
GTLDriveFile *file;
NSString *downloadedString = file.downloadUrl; // file is GTLDriveFile
NSLog(@"%@",file.downloadUrl);
GTMHTTPFetcher *fetcher = [self.driveService.fetcherService fetcherWithURLString:downloadedString];
[fetcher beginFetchWithCompletionHandler:^(NSData *data, NSError *error)
{
if (error == nil)
{
if(data != nil)
{
GTLDriveFile *file = [driveFiles objectAtIndex:indexPath.row];
filename=file.title;
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
filename = [[paths objectAtIndex:0]stringByAppendingPathComponent:[NSString stringWithFormat:@"%@",fileNames]];
NSData* Data = [[NSData alloc]initWithContentsOfURL:targetURL];
[Data writeToFile:filename atomically:YES];
NSLog(@"my path:%@",filename);
}
}
else
{
NSLog(@"Error - %@", error.description);
}
}];
// from the above code error is **Domain=com.google.GTMHTTPFetcher Code=-1 "The operation couldn’t be completed. (com.google.GTMHTTPFetcher error -1.)"**