iOS file provider extension services

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?

Answered by DTS Engineer in 798065022

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.

Accepted Answer

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.

No need for sysdiagnose. Armed with the understanding that this should work, I caught my mistake (I was working on both the provider and consumer side). My implementation of shouldAcceptNewConnection was missing a call to resume. So it was a one line fix.

The documentation's use of terms like "your app" and "host app" left me unsure who could consume the service. Thank you for clarifying.

iOS file provider extension services
 
 
Q