Ios 如何在文件管理器中拾取pdf文件?
我正在尝试在我的应用程序中开发载体表单,这里我正在尝试在我的应用程序中实现恢复上载文件上载。这里我正在为open file manager编写代码,但我不知道如何在file manager中选择pdf文件。请任何人帮助完成此操作。提前感谢Ios 如何在文件管理器中拾取pdf文件?,ios,file-upload,filepicker,Ios,File Upload,Filepicker,我正在尝试在我的应用程序中开发载体表单,这里我正在尝试在我的应用程序中实现恢复上载文件上载。这里我正在为open file manager编写代码,但我不知道如何在file manager中选择pdf文件。请任何人帮助完成此操作。提前感谢 UIButton *button = (UIButton *)sender; NSURL *URL = [[NSBundle mainBundle] URLForResource:@"test" withExtension:@"pdf"];
UIButton *button = (UIButton *)sender;
NSURL *URL = [[NSBundle mainBundle] URLForResource:@"test" withExtension:@"pdf"];
if (URL) {
// Initialize Document Interaction Controller
self.documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:URL];
//Configure Document Interaction Controller
[self.documentInteractionController setDelegate:self];
// Present Open In Menu
[self.documentInteractionController presentOpenInMenuFromRect:[button frame] inView:self.view animated:YES];
}
这是我用于open file manager的代码。试试这个
NSArray *path = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES);
NSString *docsDirectory = [path objectAtIndex:0];
NSString *filePath = [docsDirectory stringByAppendingPathComponent:@“sample.pdf"];
NSURL *pdfUrl = [NSURL fileURLWithPath:filePath];
pdf = CGPDFDocumentCreateWithURL((CFURLRef)pdfURL);
欢迎来到Stackoverflow。请阅读并确保包含您所询问的代码。此处是哪种数据类型的pdf变量?CGPDFDocumentReleasepdf;