lz項(xiàng)目需要從本地選擇視頻上傳至服務(wù)器齐媒,近期在更新至ios11之后在調(diào)試了一次,結(jié)果發(fā)現(xiàn)會(huì)被卡在列表界面纷跛,無(wú)法進(jìn)入具體的視頻位置喻括,在此記錄一下。
問(wèn)題如圖所示
原來(lái)的選擇視頻的代碼如下:
親測(cè)過(guò)贫奠,在ios10 以及ios11.0.2是不存在這個(gè)問(wèn)題的唬血,選中也不會(huì)進(jìn)入代理方法
UIImagePickerController *ipc = [[UIImagePickerController alloc] init];
ipc.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;//sourcetype有三種分別是camera望蜡,photoLibrary和photoAlbum
NSArray *availableMedia = [UIImagePickerController availableMediaTypesForSourceType:UIImagePickerControllerSourceTypeCamera];//Camera所支持的Media格式都有哪些,共有兩個(gè)分別是@"public.image",@"public.movie"
ipc.mediaTypes = @[@"public.movie"];[NSArray arrayWithObject:availableMedia[1]];//設(shè)置媒體類型為public.movie
[self presentViewController:ipc animated:YES completion:nil];
ipc.delegate = self;//設(shè)置委托
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary<NSString *,id> *)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(@"==");
};
}