开发者

how can stop creating duplicates in camera roll while using UISaveVideoAtPathToSavedPhotosAlbum to save videos in camera roll?

I have a video in applications documents folder. I need it to be saved in camera roll. So, I used UISaveVideoAtPathToSavedPhotosAlbum method to save it in camera roll. It's working and I can see the video added to camera roll.

But, the problem is every time I execute the application with same video(with same file name), it is added another time in camera roll instead of replacing the old one. So, it is creating the duplicates of the video.

How can I make the application work like if a video is present in camera roll and again added with same file name, then old one is replaced by new video.

My code is:

 -(void)exportVideo:(id)sender
{
    NSString *path = [DOCUMENTS_FOLDER stringByAppendingString:@"/air.mp4"];
    NSLog(@"Path:%@", path);
    NSLog(@"Export Button CLicked");
    UISaveVideoAtPathToSavedPhotosAlbum(path, self, @selector(video:didFinishSavingWithError: contextInfo:), nil);
}

- (void)video:(NSString *)videoPath didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo 
{
    NSLog(@"Finished saving video with erro开发者_如何学JAVAr: %@", error);
}  

Thank you.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜