Marcel Vyberal
Marcel Vyberal

Reputation: 121

Fileprovider does not get loaded when application is run from /Applications folder

I have developed a functional Application that uses the new NSFileProviderReplicatedExtension. Everything worked as expected until I started deployment and realized, that my application cannot add domain successfully while being run from /Applications folder. Calling:

[NSFileProviderManager addDomain:fileProviderDomain completionHandler:^(NSError * _Nullable error){}];

This call results in error:

Error Domain=NSFileProviderErrorDomain Code=-2001 "The application cannot be used right now." UserInfo={NSLocalizedDescription=The application cannot be used right now.}

Running the application from XCode build dir or ˜/Desktop fileprovider extension works as expected.

Upon closer inspection in console around a moment of calling "addDomain", I can see a line that does not come up when running the application from a different location.

kernel Sandbox: fileproviderd(448) deny(1) file-read-data /Applications/TestFileProvider.app

I have tried changing about everything in codesign and sandbox in build settings but no change. I have also tried making app in Obj-C and swift too - makes no difference. Any suggestions?


For reference here is my question on apple developer forums: https://developer.apple.com/forums/thread/696254

Upvotes: 4

Views: 1788

Answers (2)

T-dawg
T-dawg

Reputation: 11

I also had this issue when trying to package a FileProvider Extension into my MacOS electron application.

The key to the solution for me was as stated in @HarshitGindra's comment: I needed to add the correct provisioning profile. Turns out the automatically generated provisioning profile from XCode was using my personal developer ID as opposed to my organization ID and so notarization failed.

I determined it was a notarization issue by running the following command:

spctl -vvv --assess --type exec <path-to-app>

I recieved the error: source=Unnotarized Developer ID

Here are all the steps I took to resolve this issue:

  1. Add an "App Group" capability to my FileProvider Extension
  2. Add the App Group ID in the following format: group..
  3. Do the equivalent in electron (add App Group entitlement to entitlements file)
  4. Turn off automatic signing under your extension target in XCode
  5. Download the provisioning profile for your extension from your Apple Developer Account (you may need to create one) and set XCode to use that profile under signing

Hope this helps!

Upvotes: 1

Tid
Tid

Reputation: 11

I've succeeded to load the FileProvider plugin under /Applications folder:

  1. The application should be installed to /Applications folder as root user.
  2. The entitlements file (of main app) should contain the "com.apple.application-identifier" item.

Hope this helps.

Upvotes: 1

Related Questions