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

85 Posts
Sort by:
Post not yet marked as solved
0 Replies
39 Views
We're trying to implement a file locking mechanism to prevent multiple users from editing the same file at the same time causing conflicts. Our previous implementation worked well on Ventura, but on Sonoma, even when just previewing a file in Finder in Column View, as opposed to editing, it locks. This is the same behaviour we experienced with Apple's FruitBasket sample code. There is a isFileViewerRequest flag inside the NSFileProviderRequest object provided with the NSFileProviderReplicatedExtension enumerator function. We thought this would indicate a file being edited. After further investigation, we were told that the isFileViewerRequest flag just indicates if a file is being presented, not just edited. We find the intended behaviour a bit strange, why would anyone want an icon next to a file to indicate presented? Why is the behaviour working fine on Ventura as a locking mechanism but on Sonoma it can only be considered a presented mechanism? If the intended behaviour is to indicate a file being presented, why did it change behaviour going from Ventura to Sonoma? A feature that was useful in Ventura becomes useless in Sonoma and the fix is for us to adjust to a new meaning of it. My main question is the following: Is there a recommended mechanism to determine if a file is being edited so that we can implement locking to avoid simultaneous editing? Thanks
Posted
by __jorge.
Last updated
.
Post not yet marked as solved
0 Replies
64 Views
I'm trying to make a macOS app using SwiftUI that supports dragging arbitrary files from the app into finder. However, I'm getting this error: "Sandbox extension data required immediately for flavor public.file-url, but failed to obtain." I'm looking through the entitlements and not finding anything obvious here. I've tried various forms of NSItemProvider(): Try 1: let itemProvider = NSItemProvider(item: image.data as NSSecureCoding, typeIdentifier: image.uniformType.identifier) // Tried presenting as data itemProvider.registerDataRepresentation(for: .fileURL, visibility: .all) { completion in ... } // Tried presenting as file itemProvider.registerFileRepresentation(for: .fileURL, visibility: .all) { completion in ... } Try 2: let itemProvider1 = NSItemProvider(contentsOf: tempFileUrl, contentType: .fileURL) Tried using this form as well. In the completion handler for register*Representation(), i'm typically creating a temporary file and returning that.. (either the URL to the file or the data directly, depending on the API): let tempFileUrl = URL.temporaryDirectory.appending(path: "testfile.png") _ = tempFileUrl.startAccessingSecurityScopedResource() defer { tempFileUrl.stopAccessingSecurityScopedResource() } completion(tempFileUrl as data, nil) // option 1 completion(data, nil) // option 2 Disabling App Sandbox in the entitlements file does not work, but the error message goes away. So it seems like I have two problems: some sort of entitlement error and I must be using NSItemProvider() incorrectly. Anyone have any suggestions? I don't see to many examples out there for supporting exporting files (e.g. images) from an app into Finder. Thanks!
Posted
by dannys42.
Last updated
.
Post not yet marked as solved
0 Replies
25 Views
This sample program : @main struct DocumentPickerApp: App { var body: some Scene { DocumentGroup(newDocument: DocumentPickerDocument()) { file in ContentView(document: file.$document) } } } This sample program is running correctly on iOS, iPadOS. But this program is not running correctly on macOS. Xcode version 15.3, compile correctly all OSs, but on macOS cannot change Picker's file. I cannot understand the reason. Please tell me, the way of this problem!!
Posted Last updated
.
Post not yet marked as solved
3 Replies
232 Views
Hi all, with yesterday's macOS 14.4 update, fileproviderctl removed the listproviders option. I couldn't find a replacement. Other options like dump domain result in error: Import Cookie: Der Vorgang konnte nicht abgeschlossen werden. (GSLibraryErrorDomain-Fehler 2 - Invalid volume URL) Is there anything I can do about this except for wait for Apple to fix this? Or was removing listproviders even done intentionally? Thanks! Sebastian
Posted Last updated
.
Post not yet marked as solved
2 Replies
305 Views
I was successfully able to get the callback for file reads for the files in my mounted folder. Now we need to implement some read protection on top of that, we need to only allow some specific applications to access the data through the File provider. for that, we need to get the name or any information regarding the Application that requested the read. one thing I've seen is the request.requestingExecutable , which is coming nil for all the applications trying to read the files in the mounted folder. But i do get applications name for the things done by finder (drag&drop and Copy paste) . What are the ways I can get the reading Application names ? and what could be done for implementing data leak features working in pair with the File Provider Extension ?
Posted Last updated
.
Post not yet marked as solved
2 Replies
347 Views
Our application which isn't a sandboxed app tries to access(copies) the file from the URL given by the file provider to the application's cache path but fails with the 'operation not permitted' error. This happens in two cases 1. File Creation & 2. File Modification. Also, on checking the path, it is like "/Library/Application Support/FileProvider/{RandID}/wharf/wharf/propagate". Even we tried to access the folder using a Python script and run it via the terminal but it also failed with the same error. But when we enable the 'full disk access' option in the 'privacy & security' tab of the system settings for the application(our main app/terminal), the files can be accessed. Our application doesn't need the 'full disk access' instead it needs permission to access the file provider extension's cache path where the temp files were stored. How to get permissions for that folder and access the files (like setting the entitlement keys or other ways)? Or else Is there any way to inform the system to use our application cache path as the file provider's cache path? Any help would be appreciated.
Posted
by Kalidoss.
Last updated
.
Post marked as solved
1 Replies
146 Views
So, I'm looking into startaccessingsecurityscopedresource() function and from my current understanding this is to get temporary access to files/folders you don't implicitly have access to i.e., that don't belong to your sandbox. I can understand what it means wrt macOS, iOS, iPadOS, but what does it mean in watchOS and tvOS where there isn't any file sharing between different apps? And what is it's relevance wrt using iCloud (if there is any?)
Posted
by Ash228.
Last updated
.
Post not yet marked as solved
1 Replies
497 Views
Hello, I'm having issues running a precompiled binary through Terminal. The binary is a custom fork of software used to send code to a microprocessor through USB. The distributor is a known company and they have the binaries working on their machine (but I don't know which version of macOS they use). I was running Ventura 13.2.1 on a 2021 M1 and upgraded to Sonoma 14.3.1 — neither worked. I'm using zsh. I symlink the location of the binary, and it returns File Exists however, when I try to run the command, I receive zsh: permission denied: command then, when I sudo the command, I receive sudo: command: command not found. If this binary is not signed by Apple, could this be the reason it's not working? Could it be because I have FileVault turned on? Are others having this issue in their applications? Thank you
Posted Last updated
.
Post marked as solved
1 Replies
223 Views
For example I created a project aaa. aaa source folder is called aaa. that is aaa aaa/aaa then I put a data file in aaa/aaa/some.data now i want to test data in aaa/aaaTests/aaaTests.swift How can i access aaa/aaa/some.data in aaaTests.swift? If I want to access some.data inside aaa/aaa/ContentView.swift, how to write the code? I have been searching google and bing for days, but find no example answering my questions. Can anyone help me out? Thanks in advance.
Posted
by calidion.
Last updated
.
Post not yet marked as solved
1 Replies
312 Views
I've defined a FileDocument with an init(configuration: ReadConfiguration) .... I've got a URL via .fileImporter - now I'd like to actually read and process (the JSON content). How do I get the ReadConfiguration from the URL? (And what would I search for to avoid this probably trivial issue?) Of course, I wrote the JSON file in the first place... so I could just read the contents as Data and decode it to JSON. But then what is the point of FileDocument other than to provide .fileExporter with a required argument?
Posted
by GoZoner.
Last updated
.
Post not yet marked as solved
8 Replies
369 Views
NSFileProvider Extension based on Xamarin.Mac constantly crashes starting on MacOS 14.4 Beta Steps to Reproduce: Create simple Xamarin.Mac solution and add FileProviderExtension project Storage appears in Locations section in Finder Expected Behavior: Cloud storage shows folders content Actual Behavior: Cloud storage doesn't show folder content, just infinite running spinner FileProviderExtension process constantly crashes. It occurs only in OSX starting from 14.4 beta. Please review crash report and help me understand whats wrong and how to fix it. Simple project written with Swift and Xcode works without any issues. May be it’s related to issue described here https://forums.macrumors.com/threads/fileproviderctl-on-sonoma-14-4-here-we-f-ng-go-again.2418353. Thanks in advance! Environment-Info.log CrashReport.txt
Posted Last updated
.
Post not yet marked as solved
0 Replies
178 Views
I am trying to sync some metadata fields via NSFileProviderItem extendedAttributes and have been successful when using arbitrary tag names prefixed by "#S" This is good but pretty much useless as those fields won't be indexed by Spotlight and won't be displayed in Finder In order to have my fields displayed in Finder I am attempting to return the com.apple.metadata fields but they seem to be all systematically ignored with or without sync suffix. This is really a big limitation and surprising given the fact that the tagData call works beautifully to synchronised keywords that are then populated in the extended attributes and indexed by Spotlight. One more drop in the bucket of unanswered / undocumented questions in this forum ... Thanks for any help.
Posted Last updated
.
Post not yet marked as solved
0 Replies
198 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
756 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
302 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
247 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.2k 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
211 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
473 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
262 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
.