Search code examples
iosdocument-provider

IOS Document Provider shows "Doesn't support the file type"


I am trying to implement an iOS Document Provider Extension, specifically in order to make it possible for web-pages to access files in my app "Flyskyhy" directly. I've read through the normal documentation, and have used the standard way in XCode to add a DocumentProvider Extension target to the project. I've not changed anything in that default implementation yet, but wanted to try it out first. The extension shows up and gets called correctly when accessed from Mail (through the action Add Attachment).

However, when I try to access it from a web-page in Safari, the extension does not show up in the default list of sources:

enter image description here

Then, when I press "More", it does show up with the text "Doesn't support the file type":

enter image description here

Does anybody know what might be going on, and what I can do to make this work?

EDIT:

Because the Document Provider API's are never called, it is most likely a problem with the Info.plist. For information, that is shown here:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleDevelopmentRegion</key>
    <string>en</string>
    <key>CFBundleDisplayName</key>
    <string>Flyskyhy Documents</string>
    <key>CFBundleExecutable</key>
    <string>$(EXECUTABLE_NAME)</string>
    <key>CFBundleIdentifier</key>
    <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>$(PRODUCT_NAME)</string>
    <key>CFBundlePackageType</key>
    <string>XPC!</string>
    <key>CFBundleShortVersionString</key>
    <string>1.0</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleVersion</key>
    <string>1</string>
    <key>NSExtension</key>
    <dict>
        <key>NSExtensionAttributes</key>
        <dict>
            <key>UIDocumentPickerModes</key>
            <array>
                <string>UIDocumentPickerModeImport</string>
                <string>UIDocumentPickerModeExportToService</string>
            </array>
            <key>UIDocumentPickerSupportedFileTypes</key>
            <array>
                <string>public.content</string>
            </array>
        </dict>
        <key>NSExtensionMainStoryboard</key>
        <string>MainInterface</string>
        <key>NSExtensionPointIdentifier</key>
        <string>com.apple.fileprovider-ui</string>
    </dict>
</dict>
</plist>

Solution

  • The Apple documentation says that:

    the public.content UTI matches all document types.

    This turns out to be incorrect, according to Apple Technical Developer Support. You need to add the public.data UTI to cover all document types:

            <key>UIDocumentPickerSupportedFileTypes</key>
            <array>
                <string>public.content</string>
                <string>public.data</string>
            </array>