grunge fightr
grunge fightr

Reputation: 1370

How to move video from application documents directory to camera roll?

hallo,

i have found some iphone-camera-video-saving avfoundation code examples over the net (and also im tryin to write my own code but not finished it yet)

such examples process and do save the video (through AVAssetWriter) from the camera capture input to file located in documments directory (which i assume is the only option?)

but now - i do not even can see files in such directory to check if my video is there; i think i should move such video file to 'camera roll', how to do that??

tnx

Upvotes: 1

Views: 3343

Answers (1)

Rayfleck
Rayfleck

Reputation: 12106

Transfer to Camera Roll - here's a link that should help.

To see what's in your Documents directory, here's a code snippet:

 -(void) dump {

    NSString *docsDir = [NSHomeDirectory() stringByAppendingPathComponent:  @"Documents"];
    NSFileManager *localFileManager = [NSFileManager defaultManager];
    NSDirectoryEnumerator *dirEnum =
        [localFileManager enumeratorAtPath:docsDir];
    NSError *error=nil;

    NSLog(@" Documents Directory: %@", docsDir);
    NSString *file;
    while (file = [dirEnum nextObject]) {
        NSString *fullPath = [NSString stringWithFormat:@"%@/%@", docsDir,file];
        NSDictionary *attrs = [localFileManager attributesOfItemAtPath:fullPath error:&error];
        if ( error ) {
            NSLog(@" error - %@", error);
        } else {
          //NSLog(@" file : %@", file);
          NSInteger fsiz = [attrs fileSize];
          NSString *ftyp = [attrs fileType];
          NSDate   *fmod = [attrs fileModificationDate];
          NSLog(@"  %9d : %@ : %@ : %@",  fsiz, file, ftyp, fmod );
         }
     }
    NSLog(@" ======  End Documents Directory ========");
   }

Upvotes: 1

Related Questions