Saving a video in the form of an NSData object to file
<p>I am calling –writeToFile:atomically: on an NSData object which contains a video I just shot.
The file is not being written and if I use the version that returns an erorr object, the error is nil.</p>

<p>My code is:</p>

<pre><code>if ([[info valueForKey:UIImagePickerControllerMediaType] isEqualToString:@"public.movie"]) {
        NSURL* url = [info valueForKey:UIImagePickerControllerMediaURL];
        NSData *videoData = [NSData dataWithContentsOfURL:url];
        NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
        NSString *documentsDirectory = [paths objectAtIndex:0];
        NSString *fPath = [documentsDirectory stringByAppendingPathComponent:@"capturedVideo.MOV"];
        [videoData writeToFile:fPath atomically:YES];
}
</code></pre>

<p>The return value is NO and when I check the existence of the written file, it is not there.</p>

<p>Any ideas?</p>
