【问题标题】:Cannot download Instagram video to camera roll无法将 Instagram 视频下载到相机胶卷
【发布时间】:2015-08-27 02:03:45
【问题描述】:

我正在尝试学习 Instagram API,并且希望能够将图像和视频内容保存到我的相机胶卷中。到目前为止,图像代码工作正常,但我无法将视频保存到相机胶卷。到目前为止,这是我的代码

- (void)downloadButtonPressed:(UIButton *)sender {
if ([self.mediaModel.mediaType isEqualToString:@"video"]) {
    NSURL *videoURL = [NSURL URLWithString:_mediaModel.videoStandardResolutionURL];
    if (UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(videoURL.path)) {
        NSLog(@"compatible");
    } else {
        NSLog(@"not compatible");
    }
    //UISaveVideoAtPathToSavedPhotosAlbum(videoPath, nil, nil, nil);
} else {
    UIImageWriteToSavedPhotosAlbum(self.imageView.image, nil, nil, nil);
}

}

首先我检查媒体类型是否为视频。如果没有,则图像很容易保存。

如果不是,我检查 videoURL.path 是否兼容,但这是我卡住的地方,我收到如下错误:

Video /hphotos-xaf1/t50.2886-16/11803693_1632141970376671_10815617_n.mp4 cannot be saved to the saved photos album: Error Domain=NSURLErrorDomain Code=-1100 "The requested URL was not found on this server." UserInfo=0x7f8b48f25d00 {NSUnderlyingError=0x7f8b48f39f90 "The operation couldn’t be completed. No such file or directory", NSErrorFailingURLStringKey=file:///hphotos-xaf1/t50.2886-16/11803693_1632141970376671_10815617_n.mp4, NSErrorFailingURLKey=file:///hphotos-xaf1/t50.2886-16/11803693_1632141970376671_10815617_n.mp4, NSURL=file:///hphotos-xaf1/t50.2886-16/11803693_1632141970376671_10815617_n.mp4, NSLocalizedDescription=The requested URL was not found on this server.}

非常感谢您的帮助。非常感谢!

【问题讨论】:

    标签: ios objective-c iphone video instagram-api


    【解决方案1】:

    不要尝试直接从网络保存到已保存的相册中。下载它(使用 NSURLSession 和下载任务)。然后从那里(即,从它提供给您的本地文件 URL)将其保存到已保存的相册中。

    【讨论】:

      猜你喜欢
      • 2013-07-23
      • 2015-09-25
      • 1970-01-01
      • 2013-07-22
      • 1970-01-01
      • 1970-01-01
      • 2016-05-01
      • 2015-01-06
      • 2014-02-02
      相关资源
      最近更新 更多