File Provider

RSS for tag

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

Posts under File Provider tag

84 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

problem with .FileImporter in fisical divice
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?
6
0
650
Nov ’23
Getting FruitBasket File Provider Demo to run
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?
1
0
363
Dec ’23
Copy folder progress (File Provider)
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.
0
0
410
Dec ’23
Slow NSFileProviderEnumerator
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.
2
1
499
Dec ’23
NSFileProviderReplicatedExtension: Download triggered after upload
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.
1
1
477
Jan ’24
Howti populate Finder comment from NSFileProviderItemProtocol extendedAttributes
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 }
0
0
374
Dec ’23
Difference between vfsStruct.f_fsid and fstat.st_ino ?
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
6
0
702
Jan ’24
NSFileProviderReplicatedExtension stopped calling fetchContents
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.
0
1
353
Jan ’24
VisionOS: FileProviderUI not supported?
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.
0
0
387
Jan ’24
invalidate() called during operations
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.
0
0
353
Jan ’24
extendedAttributes won't sync com.apple.metadata attributes
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.
0
0
340
Jan ’24
NSFileProvider Extension crash on MacOS 14.4 Beta
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
9
0
775
Apr ’24
URL (via .fileImporter) to a ReadConfiguration - How to?
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?
1
0
603
Feb ’24
how to read a file under project directory for both development and runtime?
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.
1
0
553
Feb ’24
Terminal Binary: "zsh: xxxx: command not found"
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
1
0
1.5k
Feb ’24
What does startaccessingsecurityscopedresource() mean for different OS?
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?)
1
0
478
Mar ’24
macOS 14.4: fileproviderctl removed listproviders option
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
6
0
760
3w
"DocumentPickerApp" is different from macOS to iOS & iPadOS
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!!
0
0
237
Mar ’24