Ios 无法将Instagram视频下载到摄像机卷
我正在尝试学习Instagram API,我希望能够将图像和视频内容保存到我的相机卷中。到目前为止,图像代码工作正常,但我不能得到的视频保存到相机辊。这是到目前为止我的代码Ios 无法将Instagram视频下载到摄像机卷,ios,objective-c,iphone,video,instagram-api,Ios,Objective C,Iphone,Video,Instagram Api,我正在尝试学习Instagram API,我希望能够将图像和视频内容保存到我的相机卷中。到目前为止,图像代码工作正常,但我不能得到的视频保存到相机辊。这是到目前为止我的代码 - (void)downloadButtonPressed:(UIButton *)sender { if ([self.mediaModel.mediaType isEqualToString:@"video"]) { NSURL *videoURL = [NSURL URLWithString:_mediaMod
- (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.}
非常感谢你的帮助。非常感谢 不要试图将其直接从网络保存到已保存的相册中。使用NSURLSession和下载任务下载它。然后从那里保存,即从本地文件URL保存到保存的相册中