本文介绍了如何使用所有类型的UTI初始化UIDocumentPickerViewController的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想打开UIDocumentPickerViewController,它应该允许用户选择所有类型的文件。我试图提及UIDocumentPickerViewController中的所有UTI初始化方法仍无法找到某些文件的有效UTI,如rar,Visio文件,mpp,mpt
I want to open UIDocumentPickerViewController and It should allow user to select all type of files. I tried to mention all UTIs in UIDocumentPickerViewController init method still couldnt find valid UTIs for some of files like rar,Visio files,mpp,mpt
UIDocumentPickerViewController *documentPicker = [[UIDocumentPickerViewController alloc] initWithDocumentTypes:[MingleUtils allowedUTIs] inMode:UIDocumentPickerModeImport];
和
+(NSArray*)allowedUTIs{
return @[@"public.data",@"public.content",@"public.audiovisual-content",@"public.movie",@"public.audiovisual-content",@"public.video",@"public.audio",@"public.text",@"public.data",@"public.zip-archive",@"com.pkware.zip-archive",@"public.composite-content",@"public.text"];
}
推荐答案
如果你想允许任何文件类型,你应该使用
If you want to allow any file type, you should use
UIDocumentPickerViewController* documentPicker =
[[UIDocumentPickerViewController alloc] initWithDocumentTypes:@[@"public.data"]
inMode:UIDocumentPickerModeImport];
请参阅Apple文档
See apple docs for UTI concepts
这篇关于如何使用所有类型的UTI初始化UIDocumentPickerViewController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!