这是我的代码:
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
NSURL *videoURL =[info objectForKey:UIImagePickerControllerMediaURL];
if ([library videoAtPathIsCompatibleWithSavedPhotosAlbum:videoURL]) {
[library writeVideoAtPathToSavedPhotosAlbum:videoURL completionBlock:^(NSURL *assetURL, NSError *error) {
if (error) {
NSLog(@"error");
} else {
NSLog(@"video assetUrl is %@", assetURL);
}
}];
}
else NSLog(@"videoAtPath is not compatible with photos Album.");
videoURL是file:///private/var/mobile/Containers/Data/Application/B1F512EA-6D13-4DF1-86DB-F6166F0D533F/tmp/capture-T0x17511a30.tmp.pG4PbH/capturedvideo.MOV
将视频保存到已保存的相册时,我一直收到错误消息。这是回复信息:
视频/private/var/mobile/Containers/Data/Application/B1F512EA-6D13-4DF1-86DB-F6166F0D533F/tmp/capture-T0x17511a30.tmp.pG4PbH/capturedvideo.MOV无法保存到已保存的相册:错误Domain = NSURLErrorDomain Code = -1100“在此服务器上找不到请求的URL。” UserInfo = 0x1b3e5e40 {NSErrorFailingURLStringKey = file:///private/var/mobile/Containers/Data/Application/B1F512EA-6D13-4DF1-86DB-F6166F0D533F/tmp/capture-T0x17511a30.tmp.pG4PbH/capturedvideo.MOV,NSErrorFailingURLKey = file :///private/var/mobile/Containers/Data/Application/B1F512EA-6D13-4DF1-86DB-F6166F0D533F/tmp/capture-T0x17511a30.tmp.pG4PbH/capturedvideo.MOV,NSLocalizedDescription =未找到请求的网址server。,NSUnderlyingError = 0x1b2ce310“操作无法完成。没有这样的文件或目录”,NSURL = file:/// private / var / mobile / Containers / Data / Application / B1F512EA-6D13-4DF1-86DB-F6166F0D533F /tmp/capture-T0x17511a30.tmp.pG4PbH/capturedvideo.MOV}
答案 0 :(得分:1)
错误消息显示您的文件不存在,因此可能性为:
文件地址不正确,您可以查看应用的沙箱来查看该视频文件是否存在。如果存在,请检查视频是否有效且可播放。无效视频将被拒绝保存到相册。
或者您的捕获模块不起作用,因此您希望在目录中写入一些文件,但由于捕获失败,因此没有发生。