Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot test Document Provider Extension

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?

like image 882
Danny Bravo Avatar asked Dec 25 '14 13:12

Danny Bravo


1 Answers

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

like image 79
Vsh Avatar answered Oct 15 '22 12:10

Vsh