Google Drive & iOS8 UIDocumentPickerViewController - file grayed out - ios

I'm using iOS8 UIDocumentPickerViewController to export and import a zip file to different cloud services (iCloud,DropBox,Drive, etc.).
I don't have issues with iCloud and Dropbox, but with Google Drive I can't import the file because it is grayed out in the interface that displays files (export is working like a charm).
The funny thing is that if I upload a zip file to Drive via the Web interface, the file is not grayed out and I can import it via UIDocumentPickerViewController - so I suspect this is an issue during the export that create the issue when I want to import the zip file.
Notes:
The exported zip file can of course be downloaded via Google drive web interface.
I tried to use a proprietary extensions (instead of .zip) defined it the info.plist, but it is the same result (works everywhere except when importing from Drive)
I thought the issue was with the UTI passed to UIDocumentPickerViewController but I tried all kind of UTI (kUTTypeZipArchive, #"public.archive", #"public.zip-archive") with no success (in both case: with a proprietary extension, or with a .zip extension)
I also export/import XML files (with a proprietary extension) and everything is working well for all cloud services including Drive - I just had to add the "public.data" UTI in the allowed UTIs in UIDocumentPickerViewController.

This seems to be a bug in Google Drive. It does not handle the allowedUTIs correctly.
I also wanted to open my own proprietary types, but they didn't work. I had to add "public.data" to allow all files and check the extension when a document was picked. This is not as nice as if only my types were available in the picker, but it works.

Related

How to Save video file to iOS Files App using UIDocumentInteractionController

I want to write one or multiple mov/mp4 files to iOS Files App but can not find how to do it with UIDocumentInteractionController. Looking for a sample code to copy files to a subfolder of my app in iOS files app using UIDocumentInteractionController. See sample screenshot to understand what I want.
You will first need to create a File Provider extension for your app if you are storing the files remotely.
If they are only being stored locally on device you can achieve this by (in the Info.plist) either setting the UISupportsDocumentBrowser key, or by setting bother the UIFileSharingEnabled and LSSupportsOpeningDocumentsInPlace keys.
As explained in this documentation:
These keys enable other apps to open and edit the contents of your Documents directory in place. Your files also appear in both the Files app and the document browser. For more information, see the UIDocumentBrowserViewController class.

Google drive showing custom UTI files dimmed in UIDocumentBrowserViewController controller

We have created custom UTI of the file type in XML format for our iOS app. It is working fine for all other cloud service provider except for google drive. We are using UIDocumentBrowserViewController and defined our custom UTI in the app.plist file. Still, Google drive shows our application files as dimmed, as the user is unable to select the file stored in the drive. We can open the file if we provide public.xml as UTI in app.plist. But We don't want to open any XML format in our app, as we have customized XML tag for our app. Any help /point to get it solved would be highly appreciated. Thank you in advance.

iOS: Support App Group folders in local file provider

I understand that if I provide the UIFileSharingEnabled and LSSupportsOpeningDocumentsInPlace keys in Info.plist for my iOS app, files in my app's Documents folder are shown in Files.app ("On This iPad") and the documents browser.
Now my question - aside from writing a File Provider extension - is there any way to add an app group's folder or replace the Documents folder with a folder in the app group's folder?
For sharing between my extensions, I save everything in the App Group folder instead of Documents, but then, of course, Files.app doesn't have access to those files, that's why I'm asking.
I tried creating symbolic links from the documents folder to the actual file, and they are shown, but don't work correctly ("file doesn't exist").
I've also created a File Provider extension, but it was rejected by Apple because my extension isn't cloud-backed and was only for local files. According to my reviewer, a File Provider extension must be cloud-storage backed.
Thank you for your help and insights,
-Matt
It's pretty simple: No. :(
We are struggling with the same issue and its simple: You can't participate in the files app (or iTunes File Sharing) if you don't store your files in the Documents folder.
It seems like this is not well thought out. You should not integrate as a file provider unless you are actually providing a file system such as dropbox, at least that's what we've been told at WWDC. On the other side you should support stuff like iMessage extensions, today extensions,... which only are possible if your files are accessible through an app group. But this then automatically breaks the use of the Files.app as well as iTunes Filesharing.
We filed radars for that, any duplicate would help, I guess.

General iOS File Finder

In my App I would like to import various document types (video, audio, photo's, pdf and text). I can use UIImagePickerController for the photo's and videos. I can use UIDocumentPickerViewController to get all file types from an iCloud drive - but this does not seem to find any files I have created on this device (and not added to iCloud). I feel like I am missing something fundamental. NSOpenPanel is there for OSX, is there nothing equivalent for iOS?
UIDocumentPickerViewController can only access files in iCloud or a similar service (eg DropBox). There is no way to access files outside your app's sandbox. They must first be moved (or copied) to iCloud.

iCloud Drive / UIDocumentPicker confusions

I'm trying to add iCloud Drive functionality to my iPhone app, by providing 2 features:
import a document which is stored on iCloud Drive to my local app
export a document from local store to iCloud Drive
The first part is done, and it was pretty easy. I used UIDocumentPicker with UIDocumentPickerModeImport to obtain a file url, which I just read to use the document in my app.
The second part, however, kind of confuses me. If I understand it correctly, all I have to do is instantiate a UIDocumentPicker with the file url of some document from the app local store, and the UIDocumentPicker will do all the rest (= saving to iCloud Drive, in case the user picks a location there).
Is this correct? Because this is what I've implemented. And while the files show up in the folder from picker selection, they will not sync neither to my Mac nor to www.icloud.com. So it seems like they are somehow stored in "the document picker on my phone", whatever this means.
Am I doing something wrong? The file I copied to the iCloud Drive folder on my mac perfectly showed up in the import-picker on the iPhone.
Actually, the files just turned up in finder (and also www.icloud.com). So it must have been some sync issue, or it just takes a while for it to sync.
Question answered/closed :)

Resources