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

70 Posts

Post

Replies

Boosts

Views

Activity

No valid file provider found with identifier
I was able to add new domain with 'NSFileProviderManager.add' function in Xcode past 2 months. Yesterday I created .pkg file (installer file) for distribution with 'pkgbuild' and 'productbuild' commands in terminal. I successfully install application and test it then uninstall it. However after this, In Xcode I cannot add new domain anymore. I keep getting "Error Domain=NSFileProviderErrorDomain Code=-2001 "No valid file provider found with identifier ‘’." Command that used to create .pkg file pkgbuild --root "path" --scripts "path" --identifier "same bundle identifier with app" --version 1.0 --install-location /Applications "newpkg.pkg" productbuild --synthesize --package "newpkg.pkg" Distribution.xml productbuild --distribution Distribution.xml --package-path "newpath.pkg" "newpathrelease.pkg" NOTE: When app is installed (But not running). I am able to add new domain in Xcode. After I uninstall app, I start to get same error again NOTE: I uninstall app by move it to Trash from Applications directory in finder Any suggestion about add new domain in Xcode during development? Or How to fix 'No valid file provider found with identifier' error
4
0
187
Apr ’25
File Provider Extension Conflict Resolution
Hi all, i am trying to implement File Provider Extension. I have some questions about conflict resolution Same file is changed at user local and remote storage before it's synced. File has 2 different version at user local and remote storage. After trigger a new enumeration by calling signalEnumerator for the extension, I want to move user's local version to new conflicted copy (with new itemIdentifier: NSFileProviderItemIdentifier) and import remote storage version to user local (with current itemIdentifier: NSFileProviderItemIdentifier). Then users local version should uploaded to remote storage server with new conflicted copy name Any suggestion about this scenario? Or any documentation about conflict resolution
1
0
167
Mar ’25
NSFileProviderPartialContentFetching on iOS
We're experimenting with FileProvider on MacOS and iOS. One of our requirements is to support downloading partial content of files. However, this looks to be supported only on MacOS as per https://developer.apple.com/documentation/fileprovider/nsfileproviderpartialcontentfetching?language=objc. Is there an alternative for NSFileProviderPartialContentFetching on iOS? If not, can you please share any standard practice on how to accomplish this on iOS? Sample code that works on MacOS - #import <FileProvider/FileProvider.h> @interface FileProviderExtension : NSObject<NSFileProviderReplicatedExtension, NSFileProviderPartialContentFetching> For iOS platform, NSFileProviderPartialContentFetching isn't available and build fails.
1
0
156
Mar ’25
NSPOSIXErrorDomain code 12 while downloading a folder having sub directories and large number of files
Hi, I have a file provider based MacOS application where i have a drive added and am trying to download a folder from that drive. The folder has sub folders and large files in it. After some time of download started, i keep getting below error. error: ["The operation could not be completed. Cannot allocate memory", [code: 12, domain: "NSPOSIXErrorDomain"] The download action is triggered via Finder's download icon(cloud icon with down arrow). I am using native URLSession to download the files from server. No third party library is used. What could be the possible reasons for "can not allocate memory" issue?
4
0
493
Mar ’25
File Provider Extension Rollback Action
Hi all, i am trying to implement File Provider Extension. I have some scenarios that I can not figure out, User delete a file on local. 'deleteItem' callback is triggered. I send delete request to remote server. Remove server failed to apply deletion (for some reason deletion failed, blocked). I call 'completionHandler' with necessary error but here is the problem. File is removed in user local but exit in remote server. After some time 'deleteItem' callback is triggered multiple times for this file. I need to put same file in user local (rollback deletion) and stop triggered callbacks. I have a folder named "New folder". This folder is dataless (its sub items is not enumerated yet). User add a file named "a.txt" to this folder on remote server. I detect that addition. When I apply that addition with 'NSFileProviderChangeObserver' observers 'didUpdate' method then enumerate this directory "a.txt" is duplicated (a 2.txt is created). Is there any way to control folder named "New folder" is dataless (its sub items is not enumerated) so that I can skip file addition to prevent duplication. Any suggestion about above scenarios
1
0
354
Mar ’25
Can't refresh contents of File Provider -managed folder (Dropbox)
I want a user to be able to save a URL of a folder on a cloud share using the standard FileManager APIs. I'm testing with Dropbox in particular. The initial interaction is working (I can select a folder, save it as a bookmark, and scan the files in that folder). However, no changes made externally to the folder will be reflected in the app when I refresh the contents. Launching the Files app and browsing to the folder DOES show the updated contents, and once that step is complete, then my app will again show up-to-date contents. Is there perhaps some API I should be calling to trigger the Dropbox File Provider extension to update it's cache? Sample project demonstrating issue: https://github.com/dhennessy/FolderScan STEPS TO REPRODUCE Launch the app on a physical device Tap Choose, browse to folder on a Dropbox share, tap Open to select The app will show the contents of the folder (the 'test' folder) Switch to the Dropbox app and create a new subfolder of the test folder Return to the test app and tap Refresh. Notice that the changes do not appear Re-launching the app also does not show the changes Workaround Launch the Files app (or re-open the UIDocumentPickerViewController by tapping choose and then dismiss it) Tap Refresh and the changes will appear in the app Note: None of the other 'cloud file providers' (google drive, one drive, box) even allow the user to even select a folder.
5
0
590
Mar ’25
File Provider Extension Remote Server Change Apply Error
Hi all, i am trying to implement File Provider Extension. I was able to enumerate remote storage directories to local via 'enumerateItems' function of NSFileProviderEnumerator. I can apply remote storage changes like newly created files/folders, move, rename and delete operations and successfully apply them to local with 'NSFileProviderChangeObserver' class 'didUpdate' and 'didDeleteItems' functions. However when file content is updated on remote server; If file content is not fetched(file is Dataless), i can not apply this change to local. When i call 'NSFileProviderChangeObserver' class 'didUpdate' function for changed file, only DateModified attribute is updated on finder, file size is not changed to new size. If file content has been fetched, When i call 'NSFileProviderChangeObserver' class 'didUpdate' function nothing is changed, file content stay depreciated Any suggestion how to fix it?
1
0
500
Mar ’25
How to get ApplicationSupportDirectory from FileProvider extension?
I get the ApplicationSupportDirectory path like this: let path = NSSearchPathForDirectoriesInDomains(.applicationSupportDirectory, .userDomainMask, true)[0] as String however for FileProvider plugin it looks like: /var/mobile/Containers/Data/PluginKitPlugin/.../Library/Application Support/rclone.conf instead of what I get for an Application: /var/mobile/Containers/Data/Application/.../Library/Application Support I need a way to get the Application's Support Directory from the FileProvider plugin. Is that possible? If not, what other shared location I could use to access shared file between these two?
1
0
325
Feb ’25
macOS Sequoia: Shared UserDefaults don't work (the app-group is set as per macOS 15 Sequoia requirements)
I use shared UserDefaults in my Swift FileProvider extension app suite. I share data between the containing app and the extension via User Defaults initialized with init(suiteName:). Everything was working fine before macOS 15 (Sequoia). I know that Sequoia changed the way the app group should be configured. My app group is know set to "$(TeamIdentifierPrefix)com.my-company.my-app". But the containing (UI) app and the Extension read and write from and to different plist locations although the same app-group is specified for both targets in XCode. The containing app reads and writes to "~/Library/Preferences/$(TeamIdentifierPrefix)com.my-company.my-app.plist" The Extension reads and writes to "~/Library/Containers/com.my-company.my-app.provider/Data/Library/Preferences$(TeamIdentifierPrefix)com.my-company.my-app.plist" Both of these locations seem completely illogical for shared UserDefaults. I checked the value returned by FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: "$(TeamIdentifierPrefix)com.my-company.my-app" in both the containing app and the Extension and the value in both of them is the same but has nothing to do with the actual paths where the data is stored as provided above. (The value is as expected - "~/Library/Group Containers/$(TeamIdentifierPrefix)com.my-company.my-app/" P.S. Of course, $(TeamIdentifierPrefix), my-company and my-app here are placeholders for my actual values.
2
0
845
Feb ’25
[Bug] UIDocumentPickerViewController Crash: “DocumentManager service tried to send a message to a deallocated host proxy”
We are experiencing an issue where UIDocumentPickerViewController causes an uncaught exception when it is dismissed under certain conditions. The error appears as: <NSXPCConnection: 0x301ac7660> connection from pid 2075 on anonymousListener or serviceListener: Warning: Exception caught during invocation of selector _updateRemoteBarButtonFrames:forUUID:, dropping incoming message and invalidating the connection. Exception: DocumentManager service tried to send a message to a deallocated host proxy DocumentManager service tried to send a message to a deallocated host proxy ( 0 CoreFoundation 0x0000000186c2a608 0013A8B1-2524-3534-B5BA-681AAF18C798 + 185864 1 libobjc.A.dylib 0x00000001841a5244 objc_exception_throw + 88 2 Foundation 0x000000018602eec0 E2F95328-659E-3C01-97F7-52B5B3BB7AA5 + 8576704 3 DocumentManager 0x00000002177cf7b8 0BAEFA1B-BD6D-3472-A1B3-6E09F5DE54F2 + 96184 4 CoreFoundation 0x0000000186c2d078 0013A8B1-2524-3534-B5BA-681AAF18C798 + 196728 5 CoreFoundation 0x0000000186c2cef0 _CF_forwarding_prep_0 + 96 6 Foundation 0x00000001858b8d8c E2F95328-659E-3C01-97F7-52B5B3BB7AA5 + 753036 7 Foundation 0x00000001858b7fc8 E2F95328-659E-3C01-97F7-52B5B3BB7AA5 + 749512 8 Foundation 0x00000001858b7220 E2F95328-659E-3C01-97F7-52B5B3BB7AA5 + 746016 9 Foundation 0x00000001858b70d8 E2F95328-659E-3C01-97F7-52B5B3BB7AA5 + 745688 10 libxpc.dylib 0x00000002119f1a50 527F7127-9586-32C8-9D8B-2972D39EAD7A + 72272 11 libxpc.dylib 0x00000002119f35cc 527F7127-9586-32C8-9D8B-2972D39EAD7A + 79308 12 libdispatch.dylib 0x000000010160a638 _dispatch_client_callout4 + 20 13 libdispatch.dylib 0x0000000101627eac _dispatch_mach_msg_invoke + 512 14 libdispatch.dylib 0x000000010161226c _dispatch_lane_serial_drain + 352 15 libdispatch.dylib 0x0000000101628ea4 _dispatch_mach_invoke + 492 16 libdispatch.dylib 0x000000010161226c _dispatch_lane_serial_drain + 352 17 libdispatch.dylib 0x0000000101613290 _dispatch_lane_invoke + 460 18 libdispatch.dylib 0x00000001016206fc _dispatch_root_queue_drain_deferred_wlh + 328 19 libdispatch.dylib 0x000000010161fd0c _dispatch_workloop_worker_thread + 580 20 libsystem_pthread.dylib 0x0000000211998680 _pthread_wqthread + 288 21 libsystem_pthread.dylib 0x0000000211996474 start_wqthread + 8 ) *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'DocumentManager service tried to send a message to a deallocated host proxy' Steps to Reproduce Present a UIDocumentPickerViewController inside a custom UIViewController. Dismiss the parent UIViewController before UIDocumentPickerViewController is fully visible. Swipe down or press the “Cancel” button in the picker. Occasionally, the system forcefully terminates the view service, causing a crash. Workarounds Tried (Unsuccessful) Using UIAdaptivePresentationControllerDelegate – Not Called for UIDocumentPickerViewController. Using viewDidDisappear to clean up – Not Called when the system terminates the picker. Forcing dismissal before presenting a new picker Reference to Line 42 in DOCRemoteViewController.m From the error traceback, we see a reference to DOCRemoteViewController.m line 42, which strongly suggests that UIDocumentPickerViewController relies on a background process to manage its lifecycle. Since we don’t have access to Apple’s private code, we assume that the DocumentManager service is trying to send a message to an already deallocated instance of UIDocumentPickerViewController, leading to a crash. One of the example wrapper implementation of us: class DocumentPickerViewController: UIViewController, UIDocumentPickerDelegate { private var picker: UIDocumentPickerViewController? weak var delegate: UIDocumentPickerDelegate? override func viewDidLoad() { super.viewDidLoad() print("📄 DocumentPickerViewController - viewDidLoad() called") setupDocumentPicker() } override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) print("📄 DocumentPickerViewController - viewDidAppear() called") } override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) print("📄 DocumentPickerViewController - viewWillAppear() called") } override func viewWillDisappear(_ animated: Bool) { super.viewWillDisappear(animated) print("📄 DocumentPickerViewController - viewWillDisappear() called") } override func viewDidDisappear(_ animated: Bool) { super.viewDidDisappear(animated) print("📄 DocumentPickerViewController - viewDidDisappear() called") } deinit { print("🗑 DocumentPickerViewController - deinit() called") } // MARK: - Setup Document Picker private func setupDocumentPicker() { picker = UIDocumentPickerViewController(forOpeningContentTypes: [.pdf]) picker?.delegate = self picker?.allowsMultipleSelection = false picker?.modalPresentationStyle = .formSheet if let picker = picker { present(picker, animated: false) { print("📄 Document Picker fully presented") } } } // MARK: - UIDocumentPickerDelegate Methods func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL]) { print("✅ User selected document(s): \(urls)") delegate?.documentPicker?(controller, didPickDocumentsAt: urls) dismissSelf() } func documentPickerWasCancelled(_ controller: UIDocumentPickerViewController) { print("❌ User cancelled document selection") delegate?.documentPickerWasCancelled?(controller) dismissSelf() } private func dismissSelf() { DispatchQueue.main.async { [weak self] in self?.dismiss(animated: true) } } } And logs for this implementation: 📄 Document Picker fully presented 📄 DocumentPickerViewController - viewDidAppear() called ❌ User cancelled document selection The view service did terminate with error: Error Domain=_UIViewServiceErrorDomain Code=1 "(null)" UserInfo={Terminated=disconnect method} 📄 DocumentPickerViewController - viewDidLoad() called 📄 Document Picker fully presented 📄 DocumentPickerViewController - viewDidAppear() called would appreciate any workarounds from the community to prevent crashes related to this issue!
4
1
823
Feb ’25