How to initialize UIDocumentPickerViewController with all types of UTI

I want to open the UIDocumentPickerViewController, and it should allow the user to select all file types. I tried to mention all the UTIs in the initialization method of the UIDocumentPickerViewController, but could not yet find valid UTIs for some files, such as rar, Visio, mpp, mpt files

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"]; } 
+12
ios objective-c icloud uidocumentpickervc
source share
4 answers

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

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

See apple docs for UTI Concepts

+27
source share
 UIDocumentPickerViewController* documentPicker = [[UIDocumentPickerViewController alloc] initWithDocumentTypes:@[@"public.item"] inMode:UIDocumentPickerModeImport]; 
+3
source share

I think your best shot is to use abstract UTI types .

The use of kUTTypeContent and kUTTypeItem should cover most file types.

0
source share

Swift 5:

 import MobileCoreServices let importMenu = UIDocumentPickerViewController(documentTypes: ["public.item"], in: .import) importMenu.delegate = self importMenu.modalPresentationStyle = .fullScreen self.present(importMenu, animated: true, completion: nil) 
0
source share

All Articles