保存UIImagePicker视频

Ale*_*lex 3 video save nsdictionary uiimagepickercontroller

我搜索并搜索但找不到基本的UIImagepicker视频保存代码.我已经完成了所有设置并且只是空白.

- (void)imagePickerController:(UIImagePickerController *)
         picker didFinishPickingMediaWithInfo:(NSDictionary *)
              info{
}
Run Code Online (Sandbox Code Playgroud)

我知道它与字典有关,但在那之后我迷路了,有什么帮助吗?

Che*_*ara 8

尝试使用此代码将视频保存在相册中.

    - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
    {
        [self dismissModalViewControllerAnimated:YES];

        //get the videoURL 
        NSString *tempFilePath = [[info objectForKey:UIImagePickerControllerMediaURL] path];

        if ( UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(tempFilePath))
        {
                // Copy it to the camera roll.
                UISaveVideoAtPathToSavedPhotosAlbum(tempFilePath, self, @selector(video:didFinishSavingWithError:contextInfo:), tempFilePath);
            } 
    }

    - (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {
        [self dismissModalViewControllerAnimated:YES];
    }

    - (void) video: (NSString *) videoPath
    didFinishSavingWithError: (NSError *) error
       contextInfo: (void *) contextInfo {
        NSLog(@"Finished saving video with error: %@", error);
    }
Run Code Online (Sandbox Code Playgroud)