Cannot test Document Provider Extension

1.5k Views Asked by At

I'm am trying to implement a Document provider extension for my app in order to allow imports / exports / moves of files between apps.

I've created my main app and added both the document provider and the file provider extensions to the project, checking that they all form part of the same App Group Identifier in each of the target's Capabilities.

The info plist for the document provider target has the following settings:

<dict>
    <key>NSExtensionAttributes</key>
    <dict>
        <key>UIDocumentPickerModes</key>
        <array>
            <string>UIDocumentPickerModeImport</string>
            <string>UIDocumentPickerModeExportToService</string>
            <string>UIDocumentPickerModeMoveToService</string>
        </array>
        <key>UIDocumentPickerSupportedFileTypes</key>
        <array>
            <string>public.content</string>
        </array>
    </dict>
    <key>NSExtensionMainStoryboard</key>
    <string>Main</string>
    <key>NSExtensionPointIdentifier</key>
    <string>com.apple.fileprovider-ui</string>
</dict>

Whilst the info.plist for the file provider has the following:

<dict>
    <key>NSExtensionFileProviderDocumentGroup</key>
    <string>group.com.myAppGroupId</string>
    <key>NSExtensionPointIdentifier</key>
    <string>com.apple.fileprovider-nonui</string>
    <key>NSExtensionPrincipalClass</key>
    <string>$(PRODUCT_MODULE_NAME).FileProvider</string>
</dict>

I am using the default implementations for both the UIDocumentPickerExtensionViewController subclass and the NSFileProviderExtension subclass that come generated when I create the targets, and I have put breakpoints in every method to test that they run appropriately.

But when I try and run the Document Provider, I can't get my app to show in the list of apps available for sharing the document. I have tested this with both my device and the simulator, selecting both iPhoto and Pages as host apps.

Am I missing something here?

1

There are 1 best solutions below

1
On

Please make sure your app group contianer is same as that of the one written for your file provider's info.plist

<key>NSExtensionFileProviderDocumentGroup</key>
<string>group.com.myAppGroupId</string>

This was happened to me, but when i change it to the proper app group name above, the picker started working.

Thanks,

Vsh