将视频保存到设备库iOS?

时间:2014-09-17 10:47:09

标签: ios iphone

我遇到了这个问题,即设备没有足够的空间将NSDocumentsDirectory中存在的视频文件保存到照片库。

问题是,UISaveVideoAtPathToSavedPhotosAlbum在保存时不会抛出任何错误。

UISaveVideoAtPathToSavedPhotosAlbum(session.outputURL.path, self, @selector (video:didFinishSavingWithError:contextInfo:), nil); //session is AVAssetExportSession


- (void)video:(NSString *)videoPath didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo
{
    [MBProgressHUD hideHUDForView:self.view animated:YES];

    if(error) //else part is executed every time...
    {
        ALERT_WITH_MESSAGE([@"Your composition could not be saved to your device library. Error: " stringByAppendingString:error.description]);
    }

    else
    {
        ALERT_WITH_MESSAGE(@"Your composition has been saved to your device library.");
    }
}

1 个答案:

答案 0 :(得分:-3)

如果您的意思是ALERT_WITH_MESSAGE没有显示,请尝试发表评论[MBProgressHUD hideHUDForView:self.view animated:YES];或者添加一些延迟... {某些时候这个HUD被视为一个警报本身}