我想从图书馆中选择一个视频。这是我的代码。
picker1 = [[UIImagePickerController alloc] init];
picker1.delegate = self;
NSArray *mediaTypesAllowed = [UIImagePickerController availableMediaTypesForSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
picker1.sourceType=UIImagePickerControllerSourceTypeSavedPhotosAlbum;
picker1.mediaTypes = mediaTypesAllowed;
[self presentModalViewController:picker1 animated:YES];
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
[picker dismissModalViewControllerAnimated:YES];
if ([picker isEqual:picker1])
{
NSString *mediaType = [info valueForKey:UIImagePickerControllerMediaType];
if([mediaType isEqualToString:@"public.movie"]){
NSLog(@"%@",info);
}
}
问题是当我从图书馆选择视频时,模拟器被绞死了。甚至委托方法didFinishPickingMediaWithInfo没有调用
提前致谢。
答案 0 :(得分:0)
试试这个
myImagePickerController.mediaTypes =
[[NSArray alloc] initWithObjects: (NSString *) kUTTypeMovie, nil];
或参考此 UIImagePickerControllerMediaType 希望这有助于你