0

我想使用 iPhone 应用程序捕获视频。在这个视频文件中,我想存储本地应用程序。如何将此文件保存在本地。请帮我。

提前致谢

4

1 回答 1

1

你能行的 :

-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info 
{      
    NSURL *videoURL = [info objectForKey:UIImagePickerControllerMediaURL];

    NSData *videoData = [NSData dataWithContentsOfURL:videoURL];
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];
    NSString *tempPath = [documentsDirectory stringByAppendingFormat:@"/vid1.mp4"];

    BOOL success = [videoData writeToFile:tempPath atomically:NO];


    [picker dismissModalViewControllerAnimated:YES];
}
于 2012-06-12T07:06:48.187 回答