Picking fonts from Google Drive with UIDocumentPickerViewController

I'm trying to pick *otf* and *ttf* font files with UIDocumentPickerViewController with this line of code:


UIDocumentPickerViewController *picker = [[UIDocumentPickerViewController alloc] 
     initWithDocumentTypes:@[@"public.opentype-font", @"public.truetype-ttf-font"] inMode:UIDocumentPickerModeImport];

This works perfectly with iCloud Drive, Dropbox, Box, etc. All non-font files are grayed out, and picking a font file works as expected.


But it doesn't work if I select Google Drive, there all files are grayed out, I cannot select the font files.


I tried to change the document types to just "public.content", but even with that, the font files on Google Drive are still grayed out.


Anybody has any idea what could be the problem here?


Thanks!


Cheers,

Zsombor

Replies

Hey! Were you able to fix this?

Here you go my friends. This is the answer to your solution.

Code Block XML
<key>UTImportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.font</string>
</array>
<key>UTTypeDescription</key>
<string>TTF File</string>
<key>UTTypeIconFiles</key>
<array/>
<key>UTTypeIdentifier</key>
<string>{bundle_id}.ttf</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>ttf</string>
</array>
<key>public.mime-type</key>
<string>application/x-font-ttf</string>
</dict>
</dict>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.font</string>
</array>
<key>UTTypeDescription</key>
<string>OTF File</string>
<key>UTTypeIconFiles</key>
<array/>
<key>UTTypeIdentifier</key>
<string>{bundle_id}.otf</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>otf</string>
</array>
<key>public.mime-type</key>
<string>application/x-font-otf</string>
</dict>
</dict>
</array>