File Provider

RSS for tag

Allow other apps to access the documents and directories stored and managed by your containing app using File Provider.

File Provider Documentation

Pinned Posts

Posts under File Provider tag

88 Posts
Sort by:
Post not yet marked as solved
0 Replies
273 Views
Hello, I had a strange bug in a File Provider app and I found out that the problem was that NSFileProviderEnumerator's invalidate() was called during an operation (a download or even a file enumeration operation from the server). The files are stored on a server and while fetchContent is called and the extension waits for the server to send the file (or enumerate a long list of files), invalidate() is called. And after some time the extension is re-initialised. I know that the extension can be deallocated by the OS from time to time, but why during an operation? If a do a cleanup inside invalidate() I will lose references to my downloads or operations. Any thoughts on this? Is there any way to prevent this? Thank you.
Posted Last updated
.
Post not yet marked as solved
2 Replies
825 Views
I have a Login Item that is bundled with my .app and can run in the background. The Login Item has a File Provider extension. When a user downloads and installs a new version of the main .app, what's the correct way to handle stopping and restarting the login item and File Provider related processes to make sure they are running the latest code also?
Posted
by spakanati.
Last updated
.
Post not yet marked as solved
1 Replies
371 Views
Hello, I have another quick question. I'm using NSFileProviderReplicatedExtension to create a macOS File Provider app to access remote files directly in Finder. When I copy a file to a remote folder (managed by File Provider) "createItem(basedOn itemTemplate: NSFileProviderItem, fields: NSFileProviderItemFields ....)" is triggered and this is fine. But immediately after the file is upload fetchContents(for itemIdentifier: NSFileProviderItemIdentifier, version ...)" is also triggered. Is this expected? Downloading again the file after upload requires some time and it's not the best experience for the user if he is in a hurry. Is there any way to prevent this? Thank you.
Posted Last updated
.
Post not yet marked as solved
0 Replies
316 Views
Hello folks, While the API for FileProviderUI is listed as supporting VisionOS 1.0, Xcode Cloud complains at the first step of the build with: "Unsupported Platform. The extension bundle LaTerminal.app/PlugIns/LaTerminalFileProviderUI.appex is not supported for this platform. Please refer to the App Extension Programming Guide at http://developer.apple.com." I also noticed that while you can create a FileExtension from Xcode, there is no template for creating the FileExtensionUI on Xcode for VisionOS projects. Could use some guidance as to what I could be doing wrong.
Posted Last updated
.
Post not yet marked as solved
0 Replies
1.3k Views
General: DevForums tags: Files and Storage, Finder Sync, File Provider, Disk Arbitration, APFS File System Programming Guide On File System Permissions DevForums post File Provider framework Finder Sync framework App Extension Programming Guide > App Extension Types > Finder Sync Disk Arbitration Programming Guide Mass Storage Device Driver Programming Guide Device File Access Guide for Storage Devices Apple File System Guide TN1150 HFS Plus Volume Format Extended Attributes and Zip Archives File system changes introduced in iOS 17 DevForums post Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myEmail = "eskimo" + "1" + "@" + "apple.com"
Posted
by eskimo.
Last updated
.
Post not yet marked as solved
0 Replies
268 Views
Hello all, When copying a lot of files using NSFileProviderReplicatedExtension (more than 2000 files) to the a local storage, fetchContents is called for each file, but usually after around 2000 files, fetchContents is not called anymore. No errors, no invalidate() called, no cancelations, no log messages, just silence. Is there any explanation or solution for this behaviour? I want the extension to provide all files until the end. By the way, if the transfer fails, but you double click on the local folder a "Finish Copying" option is presented and after that fetchContents for the remaining files is called (which is good). Thank you.
Posted Last updated
.
Post not yet marked as solved
6 Replies
566 Views
Hello, Anyone know of relevant documentation that captures the difference between vfsStruct.f_fsid and fstat.st_ino ? sys/stat.h declares: ino_t st_ino; /* [XSI] File serial number */ AND sys/statvfs.h declares: unsigned long f_fsid; /* Filesystem ID */ Based on some tests, it seems that the st_ino is the number/inode_number that the filesystem identifies the file-resource by ? I observed that this number gets a unique value when I copy a file even when the Finder/FS utilizes the Space-Saver feature of MacOS. This value is identical to the results returned by the command ls "-i" . When copying via Finder, I am seeing distinct st_ino values for source and destination files. f_fsid seems to be identifying the File differently though, perhaps taking into account what Data/attributes objects the file resource points to ? I observed that this number gets an identical value when I copy a file even when the Finder/FS utilizes the Space-Saver feature of MacOS. So, the value of f_fsid seems to be copied over to the destination file record. Also, I could not find a way to display f_fsid via the ls command. On a related note, Any documentation regarding MacOS Finder/FS's Space-Saver feature or how it is implemented ? Thanks, Vikram.S.Warraich
Posted
by Vikram_SW.
Last updated
.
Post not yet marked as solved
0 Replies
312 Views
I am trying to populate the Finder comment field from extendedAttributes with the code bellow but it doesn't work. Any idea why ? var extendedAttributes: [String : Data] { var attrs = [String: Data]() let comment = self.caption do { let xmlPlistData = try PropertyListSerialization.data(fromPropertyList: comment as Any, format: .xml, options: 0) attrs["com.apple.metadata:kMDItemFinderComment"] = xmlPlistData } catch { NSLog("Error during plist conversion: \(error)") } return attrs }
Posted Last updated
.
Post not yet marked as solved
2 Replies
388 Views
Hello, I'm having some problems in implementing a File Provider based app. NSFileProviderEnumerator is very slow for many files (over 2000 files). I'm using pagination like this: observer.didEnumerate(paged_files) // page size is usually 200 let nextPage = NSFileProviderPage((page + 1).description.data(using: .utf8)!) observer.finishEnumerating(upTo: nextPage) and observer.finishEnumerating(upTo: nil) when finished all pages. But after calling "observer.finishEnumerating(upTo: nil)" it still takes a lot of time (20-30 seconds) until all files are listed in Finder. Any tips? Thank you.
Posted Last updated
.
Post not yet marked as solved
0 Replies
328 Views
Hello, I have a quick question. In my File Provider based Mac application, if the user copies a folder to his computer, the "download" progress indicator near the folder name (the one from Finder) is showing only if the user entered the folder before. If the user did not enter the folder before and copies the folder, the progress indicator is showing always zero and jumps to 100% after the copy operation is over. Any thought on this? Thank you.
Posted Last updated
.
Post marked as solved
1 Replies
304 Views
tl;dr I'm trying to get the FruitBasket demo to operate (Synchronizing files using file provider extensions | Apple Developer Documentation) on Sonoma 14.1.2. I'm probably being stupid about something but It doesn't work as I expect so would welcome any suggestions. Details I downloaded the FruitBasket demo code I attempted to carefully follow the README and replace all instances of group.com.example.apple-samplecode.FruitBasket I built and ran and created a domain My new domain appears in the Finder side-bar. It appears as a directory in ~Library/CloudStorage/. But attempting to (e.g.) ls ~/Library/CloudStorage/* gives me an ETIMEDOUT error and the Finder says something similar. Things that I observed: once a domain exists, there is indeed a Provider executable running. it never generates any log messages attaching the Xcode debugger to it and setting some seemingly likely to be invoked breakpoints (e.g. Extension.Extension.enumerator) never hit the breakpoints. my naïve take on the disassembly when pausing it suggests that it's waiting for incoming Mach messages. (That seemed sensible.) FruitBasket starts with an error: Couldn't read values in CFPrefsPlistSource<0x6000039853b0> (Domain group.org.liqui.apple-samplecode.FruitBasket, User: kCFPreferencesAnyUser, ByHost: Yes, Container: (null), Contents Need Refresh: Yes): Using kCFPreferencesAnyUser with a container is only allowed for System Containers, detaching from cfprefsd Questions Does the above error suggest that I have set the group value wrong somewhere? Maybe Extension+Servicing.swift:21 defining the NSFileProviderServiceName("com.example.FruitService") is mismatched somewhere?
Posted
by rjkroege.
Last updated
.
Post marked as solved
1 Replies
568 Views
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: NSFileProviderContentPolicy With Evict Capability Without Evict Capability None (i.e. default) 2008 Failed to evict 2008 Failed to evict inherited 2008 Failed to evict 2008 Failed to evict downloadLazily 2008 Failed to evict 2008 Failed to evict downloadEagerlyAndKeepDownloaded 2008 Failed to evict 2008 Failed to evict downloadLazilyAndEvictOnRemoteUpdate 2008 Failed to evict 2008 Failed to evict What am I missing? Is the documentation outdated? Is this a bug? Any tips will be greatly appreciated!
Posted
by T-dawg.
Last updated
.
Post not yet marked as solved
6 Replies
539 Views
Hello, I was testing with forms in applications in xcode, I created a button to import a file and a simple label where the name of the file was displayed. This tested in a simulator works perfectly, but when I send it to TestFlight and download it to my iPad, it opens the documentPicker but when I choose a file it does not load anything. No errors shown, no permissions issues. What could it be?
Posted Last updated
.
Post not yet marked as solved
3 Replies
589 Views
I am developing a cloud-based application and have integrated the FileProviderExtension. However, files larger than 20 MB are not downloading as it’s throwing a memory limit exception. In this process, I have downloaded the file data, but after downloading the data, I need to decrypt the data. I am getting a memory limit exception during decryption. I am using the below lines to decrypt the data. let symmetricKey = SymmetricKey(data: key) let sealedBox = try AES.GCM.SealedBox(combined: inputData) let decryptedData = try AES.GCM.open(sealedBox, using: symmetricKey) I am getting memory limit exception at AES.GCM.open(sealedBox, using: symmetricKey)
Posted Last updated
.
Post not yet marked as solved
1 Replies
494 Views
I am developing a cloud-based application and have integrated the FileProviderExtension. However, files larger than 20 MB are not downloading as it’s throwing a memory limit exception. In this process I have downloaded the file data but after downloaded data need to decompression the data . I am getting memory limit exception during decompression. I am using below file to decompress the data. let decompressedData = try? decryptedChunkBytes?.gunzipped() Data+Gzip.swift
Posted Last updated
.
Post not yet marked as solved
2 Replies
1.3k Views
My project has a base app which is manually signed, inside I have a FileProvider parent app and extension. When things works elegantly in Xcode debug build when I run FP App. But, when I package it, the FileProvider can't mount, fails with a generic error on parent app (Error Domain=NSFileProviderErrorDomain Code=-2001 "The application cannot be used right now." UserInfo={NSLocalizedDescription=The application cannot be used right now.} Another generic error in FileProvider demon fileproviderd(488) deny(1) file-read-data /Applications/XYZ.app/Contents/Resources/FileFP.app How to solve this?
Posted Last updated
.
Post not yet marked as solved
0 Replies
249 Views
I'm working on a Replicated File Provider extension for macOS. I've come across an issue recently on macOS 13+. It seems that the displayName of the domain changes when I call addDomain multiple times with the same NSFileProviderDomainIdentifier but with different displayName parameters. This behavior seems correct so far. However, the displayName, and of course the actual path under CloudStorage, revert back to their original values when I call disconnect to a domain manager. Here's the code snippet of getting existing doamin and disconnecting it: NSFileProviderManager.getDomainsWithCompletionHandler() { domainList, error in defer { dispatchGroup.leave() } for domain in domainList { if domain.identifier == NSFileProviderDomainIdentifier(rawValue: String(sessionId)){ domainResult = domain break } } } dispatchGroup.wait() guard let manager = NSFileProviderManager(for: domainResult) else { return -1 } manager.disconnect(reason: disconnectReason, options: []) { error in defer { dispatchGroup.leave() } errorResult = error } dispatchGroup.wait() Could a member of the internal team please help confirm if this is the correct method for updating the displayName of an existing domain? Additionally, is there a way to ensure that the new displayName persists even after disconnecting it? It would be great to allow users to customize and set a meaningful name for it. Thanks. Min
Posted
by minlee.
Last updated
.
Post not yet marked as solved
0 Replies
413 Views
Hello, I want to fetch all local music files from an iPhone device. I tried MPMediaQuery but I can get only that file which is in the document folder.If we use UIDocumentpicker we can fetch all files from the iPhone (downloads, File Application)after selection by the user. I want to fetch all music files like UIDocumentpicker but without user interaction. Thanks in Advance for your guidance.
Posted Last updated
.