Closed CarlaTeo closed 6 years ago
What settings are you using to open the picker?
@dantman I'm using this:
DocumentPicker.show({ filetype: ['public.content'] }, (error, response) => {
if (error) {
doReject(error);
} else {
doResolve(decodeURIComponent(response.uri));
}
});
This situation happened to some Androids too, but cleaning the cache of Google Drive solved the problem to them, but not to iOS users.
Try adding 'com.adobe.pdf'
to your filetype
list.
Then instead of that try adding 'com.microsoft.word.doc', 'com.microsoft.excel.xls'
.
Using 'com.adobe.pdf'
only the pdf file was selectable, and using 'com.microsoft.word.doc', 'com.microsoft.excel.xls'
none of them became selectable...=/
com.adobe.pdf
inherits from public.data
and public.composite-content
, public.composite-content
inherits from public.content
. So it's strange if it's only available when listing pdf. But I guess that's just a Drive/iOS quirk.
If the word and excel UTIs don't work, then Drive is either using mysterious unidentified custom UTIs we don't know or using the root public.item
and not bothering to give their documents proper types.
You can use public.item
, but that will select absolutely everything. Including any non-content items declaring UTis for databases, calendar events, emails, SMS messages, executable binaries, archives, URLs, vCards, etc if the document provider exposes them.
Thank you very much, Daniel, it does the job. Later I'll explore more what UTIs Google might be using, but for now I'll stay with your fix. 😄
PS: I also asked on StackOverflow, you may post your solution there too so that I can accept. Otherwise, later I'll answer it myself and link it to your answer here.
You could try out org.openxmlformats.spreadsheetml.sheet
.
Also, if you switch to v3 you could add something like this to export the UTI in the metadata:
NSString *utiString = (__bridge_transfer NSString *)uti;
[result setValue:utiString forKey:@"uti"];
Then you can use public.item
to make everything selectable and investigate what Drive gives for the UTI when you select it. (Though it's based on file extension so I can't guarantee it's the same, but it's a start)
I tried org.openxmlformats.spreadsheetml.sheet
with no success.
I'll take a look in v3.
In the meantime, do you know by any chance how could I convert the files to PDF? Because they are being picked with gdoc/gsheet extensions, that only works in the GDrive app. =/
Android offers an API for converting to a mime type if the DocumentProvider supports it. But I am not aware of any API like that for iOS.
Native files (docs, sheets, slides) appear to be unselectable, meanwhile on Android they appear selectable as PDF (it seems they are automatically converted, but that's OK for me).
It used to work on iOS too.