I am implementing a file provider based on NSFileProviderReplicatedExtension on macOS. Currently I am working on the download of remote dataless files which works fine so far. It is materialized and available locally and the related NSFileProviderItem object I provide to the system returns true for isDownloaded and isMostRecentVersionDownloaded.
When I open the plain text file in Finder in TextEdit, then it is actually opened by the app but almost immediately the system also calls fetchContents(...) on my extension object. I do not understand why because there is no need to fetch the contents.
I tried various ways to call the mandatory completion handler of fetchContents(...), but apparently either a URL to a local content file and the NSFileProviderItem have to be provided or an Error.
Note: When opening the plain text file through Finder in TextEdit the modifyItem(...) function on my file provider extension is called, too, to update the .lastUsedDate. In that completion handler I provide false as the argument which tells the system to request the item contents.
How can I make clear that the system should not call fetchContents(...) for already downloaded files over and over again?
Post
Replies
Boosts
Views
Activity
I am trying to build an app with Xcode 12.5 Beta 3 on macOS Big Sur 11.2.2 with a file provider extension. I use the beta version of Xcode because previous versions do not provide a template for file provider extensions.
The app and its extension have a common app group set up in their entitlements and are signed automatically with my personal team and a development certificate.
I build and run my app and extension. As far as I know, I have now control over when it is (un)loaded because that is up to the system.
Observations
The extension never shows up in the system preferences.
The Console app does not provide any meaningful information. The only message with the distinct project name reports "*** (LaunchServices)" to check whether the application is managed.
The extension does not show up in the Activity Monitor.
Pluginkit reports the extension to be found but prepends an exclamation mark (when running pluginkit -vvvvmi Redacted.Hyperdrive.File-Provider).
lang-sh
$ pluginkit -vvvvmi Redacted.Hyperdrive.File-Provider
! Redacted.Hyperdrive.File-Provider(1.0)
Path = /Users/peter/Library/Developer/Xcode/DerivedData/Hyperdrive-gyfstlzpcwfgdyapkdbdsqcvxmae/Build/Products/Debug/Hyperdrive.app/Contents/PlugIns/File Provider.appex
UUID = FD87EE6B-8C82-4DFB-AF85-E9A1808517C6
Timestamp = 2021-03-09 10:47:35 +0000
SDK = com.apple.fileprovider-nonui
Parent Bundle = /Users/peter/Library/Developer/Xcode/DerivedData/Hyperdrive-gyfstlzpcwfgdyapkdbdsqcvxmae/Build/Products/Debug/Hyperdrive.app
Display Name = File Provider
Short Name = File Provider
Parent Name = Hyperdrive
(1 plug-in)
Problem
I did not find anything about the meaning of the exclamation mark or how to find out what the actual problem is.
Remark
For whatever reason the developer forum appears to censor the acronym of the launch services daemon with three asterisks. 🙄