I am trying to develop an application that also contains an extension for the Finder.
The extension can be used to create a new text file at the current Finder location. I have only added the following permissions to the entitlements file for both the main app and the extension:
com.apple.security.files.user-selected.read-only
I have implemented the FIFinderSync
protocol in my extension.
I added a menu item to create a new text file. Whenever I execute this method, the following error is shown in the Console:
Sandbox: Extension(4032) deny(1) file-write-create /Users/username/Documents/New Text.txt
The simplest way to get around this error is to add the following key:
com.apple.security.temporary-exception.files.home-relative-path.read-write
However, applications using this entitlement will be rejected during app review.
The extension is initialised with this code:
FIFinderSyncController.default().directoryURLs = [URL(fileURLWithPath: "/")]
How can I prevent this error to be thrown? I could use security scoped bookmarks, open a dialog and then save this bookmark. However, I have tested plenty of extension available in the App Store and none of them have shown any NSOpenPanel,
the files have been created without any problems.
Any help is appreciated.