Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/38.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 在解除UIImagePicker后获取视频长度?_Iphone_Objective C_Ios_Nsdata - Fatal编程技术网

Iphone 在解除UIImagePicker后获取视频长度?

Iphone 在解除UIImagePicker后获取视频长度?,iphone,objective-c,ios,nsdata,Iphone,Objective C,Ios,Nsdata,我想获得用户选择的视频长度。我在用苹果采摘器 以下是我目前的代码: [self dismissModalViewControllerAnimated:YES]; //assign the mediatype to a string //check the media type string so we can determine if its a video NSURL *videoURL = [info objectForKey:UIImagePickerController

我想获得用户选择的视频长度。我在用苹果采摘器

以下是我目前的代码:

    [self dismissModalViewControllerAnimated:YES];
//assign the mediatype to a string 
//check the media type string so we can determine if its a video
    NSURL *videoURL = [info objectForKey:UIImagePickerControllerMediaURL];
    webData = [[NSData alloc]init];
    webData = [NSData dataWithContentsOfURL:videoURL];
    //[self post:webData];
    video = 1;
    upload.hidden = NO;

    ImagesCopy = [[NSMutableArray alloc]initWithObjects:@"1", nil];
[tableview reloadData];
谢谢:你能做到的

AVAsset *movie = [AVAsset assetWithURL:[info objectForKey:UIImagePickerControllerMediaURL]];
CMTime movieLength = movie.duration;

这个链接可能会对你有所帮助,我该怎么做呢?我把它记为%i,一个19秒的视频得到了600。我还尝试将其记录为%@并崩溃。我想把它转换成秒。谢谢你的回答,顺便说一句。看看这里: