iOS 将视频保存到相册

先引入头文件

#import 
然后代码如下

PHPhotoLibrary *photoLibrary = [PHPhotoLibrary sharedPhotoLibrary];
    [photoLibrary performChanges:^{
        [PHAssetChangeRequest creationRequestForAssetFromVideoAtFileURL:[NSURL
    fileURLWithPath:videoFilePath]];
    } completionHandler:^(BOOL success, NSError * _Nullable error) {
        if (success) {
            NSLog(@"stopRecord=====已将视频保存至相册");
        } else {
            NSLog(@"stopRecord=====未能保存视频到相册 ==error:%@",error);


        }
    }];

你可能感兴趣的:(iOS 将视频保存到相册)