iOS保存视频到相册

保存视频:

1在工程中添加这个框架:

#import <AssetsLibrary/AssetsLibrary.h>

2

    NSBundle *bundle=[NSBundle mainBundle];

    NSString *videoPath=[bundle pathForResource:@"test" ofType:@"mp4"];//是本地的路径就好

    videoPath是你视频文件的路径,我这里是加载工程中的

    ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];

    [library writeVideoAtPathToSavedPhotosAlbum:[NSURL fileURLWithPath:videoPath]

                                completionBlock:^(NSURL *assetURL, NSError *error) {

                                    if (error) {

                                        NSLog(@"Save video fail:%@",error);

                                    } else {

                                        NSLog(@"Save video succeed.");

                                    }

                                }];

参考文献:http://blog.csdn.net/kaven_lv/article/details/11483239

原文地址:https://www.cnblogs.com/Percy/p/6209174.html