Cannot Evict Items from File Provider

Has anyone else been unable to trigger item eviction?

Note I am using MacOS Sonoma 14.1 on a Macbook Air M1.

I have attempted using both the swift API myFileProviderManager.evictItem(myItemID) as well as the CLI tool fileproviderctl evict "path/to/myFile.txt" and both return Error Domain=NSFileProviderErrorDomain Code=-2008 "The file ‘myFile.txt’ cannot be evicted.". This error maps to the nonEvictable error.

Therefore I attempted providing the necessary permissions to evict my file.

I have attempted applying all 4 possible configurations of NSFileProviderContentPolicy to this file. I have tried the legacy option of using the capability .allowsEviction. I have even tried with NSExtensionFileProviderAllowsUserControlledEviction set to both YES and NO as I noticed Dropbox was able to evict items even though this option was set to NO. None of these attempts have succeeded.

I noticed if I ran fileproviderctl evict "path/to/myFile.txt" --namespace I was able to see that the file has the contentPolicy of 1 which maps to the downloadLazily contentPolicy. The NSFileProviderContentPolicy code documentation states that with this configuration will "Allow eviction on low disk pressure and other triggers."


For clarity here is a table of my various attempts with NSExtensionFileProviderAllowsUserControlledEviction set to YES:

NSFileProviderContentPolicyWith Evict CapabilityWithout Evict Capability
None (i.e. default)2008 Failed to evict2008 Failed to evict
inherited2008 Failed to evict2008 Failed to evict
downloadLazily2008 Failed to evict2008 Failed to evict
downloadEagerlyAndKeepDownloaded2008 Failed to evict2008 Failed to evict
downloadLazilyAndEvictOnRemoteUpdate2008 Failed to evict2008 Failed to evict

What am I missing? Is the documentation outdated? Is this a bug?

Any tips will be greatly appreciated!

Answered by T-dawg in 773111022

I believe I have solved this issue. I was missing an implementation of the evictItem() function.

Accepted Answer

I believe I have solved this issue. I was missing an implementation of the evictItem() function.

Cannot Evict Items from File Provider
 
 
Q