ios 11.0.1 在相册中选择本地视频的问题

lz项目需要从本地选择视频上传至服务器,近期在更新至ios11之后在调试了一次,结果发现会被卡在列表界面,无法进入具体的视频位置,在此记录一下。
问题如图所示


ios 11.0.1 在相册中选择本地视频的问题_第1张图片
EE8562D132E5FBA9EB3053F70A6024B0.png

原来的选择视频的代码如下:
亲测过,在ios10 以及ios11.0.2是不存在这个问题的,选中也不会进入代理方法

    UIImagePickerController *ipc = [[UIImagePickerController alloc] init];
    ipc.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;//sourcetype有三种分别是camera,photoLibrary和photoAlbum
    NSArray *availableMedia = [UIImagePickerController availableMediaTypesForSourceType:UIImagePickerControllerSourceTypeCamera];//Camera所支持的Media格式都有哪些,共有两个分别是@"public.image",@"public.movie"
    
    ipc.mediaTypes = @[@"public.movie"];[NSArray arrayWithObject:availableMedia[1]];//设置媒体类型为public.movie
    [self presentViewController:ipc animated:YES completion:nil];
    ipc.delegate = self;//设置委托

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {}

最后找到解决办法:

- (void)choosevideo
{
   TZImagePickerController *imagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:1 delegate:nil];
    imagePickerVc.allowPickingImage = NO;
    [self presentViewController:imagePickerVc animated:YES completion:nil];
    imagePickerVc.didFinishPickingVideoHandle = ^(UIImage *coverImage, PHAsset * asset) {
        [[TZImageManager manager] getVideoOutputPathWithAsset:asset completion:^(NSString *outputPath) {
            [self jumpToShareVideoViewControllerWithVideoUrl:outputPath thumUrl:[self getThumUrlWithVideoUrl:outputPath]];
        }];
        NSLog(@"==");
    };
}

你可能感兴趣的:(ios 11.0.1 在相册中选择本地视频的问题)