macOS file provider error -2001

I've added file provider extension target to my macOS app. From the app I call NSFileProviderManager.add() to add my extension domain.

Unfortunately this call fails with a mysterious error message: Domain=NSFileProviderErrorDomain Code=-2001 "The application cannot be used right now." 

I'm looking for a possible cause for this error. My app is not sandboxed, but extension is. The app and extension share the same application group.

Answered by gumowemaslo in 708693022

Turns out that PluginKit error was due to --deep codesigning flag enabled for the app target.

The original error was caused by lack of $(TeamIdentifierPrefix) prefix in NSExtensionFileProviderDocumentGroup.

further analysis of console logs indicates the root cause, logged from com.apple.PlugInKit

"rejecting; Ignoring mis-configured plugin at ......: plug-ins must be sandboxed"

This is still very strange, because my file provider extension target has app sandbox target enabled. It looks like when Xcode is embedding the extension into main app target, it overwrites it's entitlements with entitlements of main app (thus dropping the app-sandbox entitlement present at earlier stages of the build).

Accepted Answer

Turns out that PluginKit error was due to --deep codesigning flag enabled for the app target.

The original error was caused by lack of $(TeamIdentifierPrefix) prefix in NSExtensionFileProviderDocumentGroup.

macOS file provider error -2001
 
 
Q