将视频保存到特定文件夹

时间:2014-08-07 10:11:32

标签: ios video save alassetslibrary photo-gallery

我正在使用以下代码将视频保存到我的PhotosAlbum:

    ALAssetsLibrary *assetLibrary = [[ALAssetsLibrary alloc] init];
    [assetLibrary writeVideoAtPathToSavedPhotosAlbum:[NSURL URLWithString:videoPath] completionBlock:^(NSURL *assetURL, NSError *error)
    {
         NSError *removeError = nil;
         [[NSFileManager defaultManager] removeItemAtURL:[NSURL URLWithString:videoPath] error:&removeError];
    });

视频转到文件夹视频,但我希望它转到带有应用名称的特定文件夹。我怎么能做到这一点?

1 个答案:

答案 0 :(得分:0)

像这样

 ALAssetsLibrary* assetLibrary = [[ALAssetsLibrary alloc] init];
 [assetLibrary writeVideoAtPathToSavedPhotosAlbum:[NSURL URLWithString:@""] completionBlock:^(NSURL *assetURL, NSError *error) {
    [assetLibrary addAssetURL:[NSURL URLWithString:@""]  toAlbum:@"" completion:^(NSURL *assetURL, NSError *error) {
    NSError* removeError = nil;
        [[NSFileManager defaultManager] removeItemAtURL:[NSURL URLWithString:@""] error:&removeError];
    } failure:^(NSError *error) {
        NSLog(@"%@", error);
    }];
}];