user1713827
user1713827

Reputation: 75

iOS: How do i prevent temporary files Visibility

i am working on a app that generates temporary video from the still image. But i don't want the user to view the temporary file what i have generated. But the moment when the app is generating the video file,the video is listing out by the camera roll.

my Question is How can i generate the temporary media file that could't have access to 'camera roll,iTunes and iCloud'?

please help me. thanks in advance.

Code:

[assetWriter finishWritingWithCompletionHandler:^
     { 
         NSURL *url = _outMovieURL; ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
         [library writeVideoAtPathToSavedPhotosAlbum:url 
                                     completionBlock:^(NSURL *assetURL, NSError *error) 
                                     { 
                                         NSLog(@"Done!"); 
                                     }]; 
     }];

Upvotes: 1

Views: 344

Answers (2)

rptwsthi
rptwsthi

Reputation: 10172

This block:

 [assetWriter finishWritingWithCompletionHandler:^
 { 
     NSURL *url = _outMovieURL; ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
     [library writeVideoAtPathToSavedPhotosAlbum:url 
                                 completionBlock:^(NSURL *assetURL, NSError *error) 
                                 { 
                                     NSLog(@"Done!"); 
                                 }]; 
 }];

Is to write file in camera roll. So don't use this while you have only created temporary video. Write that temporary video file in documentDirectory instead, (or probably it's already in documentDirectory, while you are creating it, all you need to do is to not write that file in camera roll with this code).

Upvotes: 1

overboming
overboming

Reputation: 1542

You should use NSTemporaryDirectory() and append your own affix at the end for any temporary files. Files in that directory will be cleaned by the OS or you can delete right after you are done with it.

Upvotes: 0

Related Questions