Read files from other apps that shares documents folder, without UIDocumentBrowserViewController

164 Views Asked by At

I need some sort of file sharing functionality between two independent apps (cannot use AppGroup or something like that). App1 should send to App2 n documents (n could be hundreds), App2 should elaborate these documents and send back to App1 the elaborated documents. I would like minimal user interaction (so I wouldn't use the UIActivityViewController or similar solutions)

By now I'm using custom url to allow the applications to call themselves, and the general UIPasteboard to share the documents. But since I have no control on the number or the size of the documents, I'm worried that this solution wouldn't be reliable

So I'm taking a look at the sharing features introduced in iOS 11, and I can see that using

UISupportsDocumentBrowser = TRUE

into App1's plist, I can share all the documents directory with Files app or with any document based app.

But I cannot understand if I can get the files from App1's documents folder with some sort of API, without using UIDocumentBrowserViewController.

Something like:

  • App1 set UISupportsDocumentBrowser,LSSupportsOpeningDocumentsInPlace,UIFileSharingEnabled = true and share its document folder
  • App1 call App2's custom url with a list of url of files that are inside App1's document folder
  • App2 launches and get the files reading from these urls (that are accessible because App1 share its document folder)

Does Anyone know if it's possible and there is an API to do this?

I have already tried to set UISupportsDocumentBrowser,LSSupportsOpeningDocumentsInPlace,UIFileSharingEnabled = TRUE in App1 and simply tried, from App2, to read a file url from inside App1's documents folder with Data(contentsOf: url), but this doesn't work (no read permissions)

Thanks to all!

0

There are 0 best solutions below