Using NSFileManager's getFileProviderServicesForItemAtURL method, I can list services made available by a file provider for a given item from an app unrelated to the file provider, obtain a handle to the proxy object and cast that object to the target protocol. However, attempts to invoke the protocol yield:
"The connection to service named com.apple.mobile.usermanagerd.xpc was invalidated: failed at lookup with error 159 - Sandbox restriction."
The documentation for the supportedServiceSourcesForItemIdentifier method implemented by the extension suggests only the app containing the extension can exercise the service but the documentation for getFileProviderServicesForItemAtURL does not. Should I be able to access a service from a file provider extension from an unrelated app? If so, how can the sandbox restriction be addressed?
An app (not necessarily the container app) should be able to use the services a file provider extension provides. The sandbox conflict seems to be a bug on the system side. Would you mind to file a feedback report with a sysdiagnose for the file provider folks to take a look and share your report ID here? For how to capture a sysdiagnose, see Using a Sysdiagnose Log to Debug a Hard-to-Reproduce Problem.
Best,
——
Ziqiao Chen
Worldwide Developer Relations.