Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIDocumentPickerViewController: how to open a given subdirectory

I am using UIDocumentPickerViewController with the import mode (UIDocumentPickerModeImport) in order to let the user import documents from cloud storage providers (dropbox, etc). Each time the user repeat the import process, he must browse through its folder hierarchy starting from the root of its cloud storage.

Is there a way to present a document picker on a given subdirectory ?

I am aware of the method:

[NSURL bookmarkDataWithOptions:includingResourceValuesForKeys:relativeToURL:error:]   

But I cannot connect the dots with the Document picker presentation options. I would expect a picker option to present a document picker on a given bookmarked directory url.

like image 638
FKDev Avatar asked May 06 '15 09:05

FKDev


2 Answers

You need init UIDocumentPickerViewController with url. For this action you can (and must) use initWithURL:inMode: method. That's all :)

like image 178
Vladimir Prigarin Avatar answered Nov 01 '22 21:11

Vladimir Prigarin


You need to try with UIDocumentBrowserViewController

UIDocumentBroswerViewContoller has method importDocument(at:nextToDocumentAt:mode:completionHandler:) for importing documents from local as well as remote like dropbox, iCloud etc.

like image 22
Kirit Vaghela Avatar answered Nov 01 '22 21:11

Kirit Vaghela