How to initialise UIDocumentPickerViewController with all type of UTIs

Murali picture Murali · Oct 13, 2015 · Viewed 15.5k times · Source

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];

and

+(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"];
}

Answer

LaborEtArs picture LaborEtArs · Mar 18, 2016

If you want to allow any file type, you should use

UIDocumentPickerViewController* documentPicker = 
  [[UIDocumentPickerViewController alloc] initWithDocumentTypes:@[@"public.data"]
                                                         inMode:UIDocumentPickerModeImport];

See apple docs for UTI concepts