
IM即时通讯
安全可靠、全球互通

实时音视频
流畅稳定、省钱省力
回答:
PLUGIN_BOARD_ITEM_FILE_TAG
则拦截,会话页面重写如下方法:- (void)pluginBoardView:(RCPluginBoardView *)pluginBoardView clickedItemWithTag:(NSInteger)tag;
// 根据需求添加具体文件格式 NSArray *documentTypes = @[@"public.content", @"public.text", @"public.source-code", @"public.image", @"public.audiovisual-content", @"com.adobe.pdf", @"com.apple.keynote.key", @"com.microsoft.word.doc", @"com.microsoft.excel.xls", @"com.microsoft.powerpoint.ppt"]; UIDocumentPickerViewController *documentPicker = [[UIDocumentPickerViewController alloc] initWithDocumentTypes:documentTypes inMode:UIDocumentPickerModeImport]; documentPicker.delegate = self; documentPicker.modalPresentationStyle = UIModalPresentationFullScreen; [self presentViewController:documentPicker animated:YES completion:nil];
#pragma mark - UIDocumentPickerDelegate -(void)documentPicker:(UIDocumentPickerViewController *)controller didPickDocumentAtURL:(NSURL *)url { NSFileCoordinator *coordinator = [[NSFileCoordinator alloc] initWithFilePresenter:nil]; NSError *error = nil; [coordinator coordinateReadingItemAtURL:url options:0 error:&error byAccessor:^(NSURL *newURL) { NSData *data = [NSData dataWithContentsOfURL:newURL]; if (data.length <= 0) { UIAlertController *alertCtrl = [UIAlertController alertControllerWithTitle:RCEStringFor(@"not_allow_empty") message:nil preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction *confirmAction = [UIAlertAction actionWithTitle:RCEStringFor(@"confirm_btn_title") style:(UIAlertActionStyleDefault) handler:^(UIAlertAction * _Nonnull action) { }]; [alertCtrl addAction:confirmAction]; [self presentViewController:alertCtrl animated:YES completion:nil]; return; } RCFileMessage *fileMsg = [RCFileMessage messageWithFile:[newURL path]]; [self sendMessage:fileMsg pushContent:nil]; [controller dismissViewControllerAnimated:YES completion:nil]; }]; if (error) { NSLog(@"ERROR: read data with "DocumentAtURL" failed"); } }