I am attempting to communicate with a FileProviderExtension (NSFileProviderReplicatedExtension
) using XPC.
I want to allow the controlling application to manage how the extension communicates with the remote service - e.g. tell the extension to sign in (and provide credentials to do so), sign out, etc.
I have implemented the NSFileProviderServicing
protocol in the extension and provided an NSFileProviderServiceSource
(following the FruitBasket sample code).
However, I can't see how to get a general connection to the service from the controlling application. The only method I can find is FileManager().fileProviderServicesForItem(at url: URL)
, which requires a URL for an item managed by the extension. Given the controlling application wants to perform actions like sign in, there is no item in scope and thus no URL.
I tried using NSFileProviderManager.documentStorageURL
, but this is not available on macos.
Any idea how to get the connection without a file URL? Or how to get a general purpose URL that will suffice? Or is there another IPC mechanism I should use?