Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 从应用程序导出视频';s文档到cameraRoll_Ios_Objective C_Alassetslibrary_Avassetexportsession_Camera Roll - Fatal编程技术网

Ios 从应用程序导出视频';s文档到cameraRoll

Ios 从应用程序导出视频';s文档到cameraRoll,ios,objective-c,alassetslibrary,avassetexportsession,camera-roll,Ios,Objective C,Alassetslibrary,Avassetexportsession,Camera Roll,我只想将.mp4文件导出到CameraRoll 这是我的密码 self.videoPath=@"/var/mobile/Applications/AE75E729-7F10-478B-9DAF-E730EB4231D1/Documents/Videos/aa.mp4"; AVURLAsset *avAsset = [AVURLAsset URLAssetWithURL:[NSURL fileURLWithPath:self.videoPath] options:nil]; NS

我只想将.mp4文件导出到CameraRoll

这是我的密码

self.videoPath=@"/var/mobile/Applications/AE75E729-7F10-478B-9DAF-E730EB4231D1/Documents/Videos/aa.mp4"; 
AVURLAsset *avAsset = [AVURLAsset URLAssetWithURL:[NSURL fileURLWithPath:self.videoPath] options:nil];
        NSArray *compatiblePresets = [AVAssetExportSession exportPresetsCompatibleWithAsset:avAsset];

        AVAssetExportSession *exportSession = [[AVAssetExportSession alloc]initWithAsset:avAsset presetName:AVAssetExportPresetPassthrough];
        //NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);

        exportSession.outputURL = [NSURL fileURLWithPath:self.videoPath];
        NSLog(@"videopath of your mp4 file = %@",self.videoPath);  // PATH OF YOUR .mp4 FILE
        exportSession.outputFileType = AVFileTypeMPEG4;

        //  CMTime start = CMTimeMakeWithSeconds(1.0, 600);
        //  CMTime duration = CMTimeMakeWithSeconds(3.0, 600);
        //  CMTimeRange range = CMTimeRangeMake(start, duration);
        //   exportSession.timeRange = range;
        //  UNCOMMENT ABOVE LINES FOR CROP VIDEO
        [exportSession exportAsynchronouslyWithCompletionHandler:^{

            switch ([exportSession status]) {

                case AVAssetExportSessionStatusFailed:
                    NSLog(@"Export failed: %@", [[exportSession error] localizedDescription]);

                    break;

                case AVAssetExportSessionStatusCancelled:

                    NSLog(@"Export canceled");

                    break;

                default:

                    break;

            }
            UISaveVideoAtPathToSavedPhotosAlbum(self.videoPath, self, nil, nil);
            [exportSession release];

        }];

    }
导出失败:无法保存