Importing files in iOS : UIDocumentPicker vs UIDocumentBrowser

1.5k Views Asked by At

As per the documentation, both UIDocumentPickerViewController and UIDocumentBrowserViewController can be used for importing documents outside an apps sandbox.

For selecting & importing a document from local document providers/cloud locations, which one for the above is best suited.Can i still use UIDocumentPickerViewController in iOS 11 ?

As per the following documentation Apple documentation for document picker , Before your app can use the document picker, you must turn on the iCloud Documents capabilities in Xcode and an iCloud container should be mapped to the appId.Is this mandatory if i'm only doing import operation ? I have tried using UIDocumentPickerViewController and it seems to be returning selected file path correctly even without the above mentioned entitlements.

2

There are 2 best solutions below

0
On BEST ANSWER

You do not need the entitlement if you do not need your own iCloud container. If you just want to import files, you can use UIDocumentPickerViewController without adding an entitlement.

Yes, UIDocumentPickerViewController works on iOS 11.

0
On

The UIDocumentBrowserViewController has to be the rootview of your app, therefore from my experience you can't use within an existing APP and be part of a NavigationControl (you will not be able to get the back buttons properly). In these cases we need to use the UIDocumentPickerViewController. Hope this helps.