How to enable and debug a macOS file provider extension?

3.1k views Asked by At

I am trying to build a barebone app with Xcode 12.5 Beta 3 on macOS Big Sur 11.2.2 with a file provider extension. I use the beta version of Xcode because previous versions do not provide a template for file provider extensions (example project on GitHub).

The app and its extension have a common app group set up in their entitlements and are signed automatically with my personal team and a development certificate.

I built and ran my app and extension. But, as far as I know, I have now control over when it is (un)loaded because that is up to the system.

Observations

  1. The file provider extension never shows up in the system preferences.
  2. The Console app does not provide any meaningful information with the distinct project name except "lsd (LaunchServices)" checking whether the application is managed.
  3. The extension does not show up in the Activity Monitor.
  4. Pluginkit reports the extension to be found but prepends an exclamation mark (when running pluginkit -vvvvmi SomeOrganization.SomeProduct.SomeProvider).
$ pluginkit -vvvvmi SomeOrganization.SomeProduct.SomeProvider                                                                                       
!    SomeOrganization.SomeProduct.SomeProvider(1.0)
                Path = /Users/peter/Library/Developer/Xcode/DerivedData/SomeProduct-gyyunhpcbweleidtluxpslpciwjj/Build/Products/Debug/SomeProduct.app/Contents/PlugIns/SomeProvider.appex
                UUID = E2FDC7AB-3CDD-4AEE-A2B2-CC2BA0CBC409
           Timestamp = 2021-03-09 16:49:57 +0000
                 SDK = com.apple.fileprovider-nonui
       Parent Bundle = /Users/peter/Library/Developer/Xcode/DerivedData/SomeProduct-gyyunhpcbweleidtluxpslpciwjj/Build/Products/Debug/SomeProduct.app
        Display Name = SomeProvider
          Short Name = SomeProvider
         Parent Name = SomeProduct

 (1 plug-in)
  1. Filtering the system console by the com.apple.FileProvider subsystem I stumble over these messages after building the extension (I had to reveal private values as described in this answer):
[ERROR] could not load the domain properties
[WARNING] found directory with no domain plist in it: ~/L{5}y/A{17}t/F{10}r/S{26}t.SomeProvider

There are also two others about PhotosFileProvider and com.apple.CloudDocs.MobileDocumentsFileProvider which (I guess) are unrelated. The PhotosFileProvider reports the same warning. The above path can be expanded to:

~/Library/Application Support/FileProvider/SomeOrganization.SomeProduct.SomeProvider

which contains Domains.plist having this (binary) content:

<?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>NSFileProviderDomainDefaultIdentifier</key>
    <dict>
        <key>Connected</key>
        <false/>
        <key>Enabled</key>
        <false/>
    </dict>
</dict>
</plist>

Problem

I did not find anything about the meaning of the exclamation mark or how to find out what the actual problem is. How can I debug this? The error in Console sticks out suspiciously. It appears to me like I am missing some piece in the puzzle which is not mentioned in documentation like a secret step in a how-to.

For reference: my question in the Apple Developer Forums.

1

There are 1 answers

1
AudioBubble On BEST ANSWER

Are you calling +[NSFileProviderManager addDomain:completionHandler:] from your application? https://developer.apple.com/documentation/fileprovider/nsfileprovidermanager/2890934-adddomain?language=objc

On macOS, unlike iOS, there is not a default FileProvider domain created by the system. Your application must explicitly register domains.