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

83 Posts
Sort by:
Post not yet marked as solved
0 Replies
440 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
.
Post not yet marked as solved
2 Replies
1.3k Views
My computer crashed recently, and afterwards a lot of my files wouldn't open and it said it was because of "nsfileprovidererrordomain error -2005." I tried looking up what to do but nothing online really made sense and it was not offering me a solution to the problem. What should I do?
Posted Last updated
.
Post not yet marked as solved
2 Replies
716 Views
Hello, We have an iOS app which stores PDF files locally and allows them to be opened in place for editing by third-party apps (e.g. PDF Viewer / Xodo). We have found that the technique we were using to do this is not working as expected in iOS 17, where it does in all previous iOS versions. As per the File Provider documentation,: we are storing files locally, so presume we do not need to have a File Provider extension we set to true/YES both UIFileSharingEnabled and LSSupportsOpeningDocumentsInPlace we generate an NSUrl and, via UIDocumentInteractionController presentOpenInMenu, allow the user to open the PDF in an external app On iOS 16 and lower, it works as expected; the third-party app is able to read and automatically save changes to the PDF directly in our app's folder path. For example, the Xodo logs indicate that it's opening directly from our app's path (788C7161-32EB-4AF0-964D-2A473257A791 is our application's ID): Xodo initialized document instance: <PTCoordinatedDocument: 0x282453a00> fileURL: file:///private/var/mobile/Containers/Data/Application/788C7161-32EB-4AF0-964D-2A473257A791/Documents/7cafe7e7-9da9-40cd-b233-a85b0174fe00/624cbc1e-a7c5-4c0d-8937-b0a00013b2a9.pdf Xodo opening document: <PTCoordinatedDocument: 0x282453a00> fileURL: file:///private/var/mobile/Containers/Data/Application/788C7161-32EB-4AF0-964D-2A473257A791/Documents/7cafe7e7-9da9-40cd-b233-a85b0174fe00/624cbc1e-a7c5-4c0d-8937-b0a00013b2a9.pdf On iOS 17, this no longer works correctly, and although the third-party PDF editor can read our PDF, it's quite clear that it's actually using a copy. If not quite identical to what happens when LSSupportsOpeningDocumentsInPlace is false/NO, the end result is very similar (6830EDC5-F776-4BEF-8C30-046BCA1F2DF0 is Xodo's application ID): Xodo initialized document instance: <PTCoordinatedDocument: 0x2828aae00> fileURL: file:///var/mobile/Containers/Data/Application/6830EDC5-F776-4BEF-8C30-046BCA1F2DF0/Documents/Processed%20Files/624cbc1e-a7c5-4c0d-8937-b0a00013b2a9.pdf Xodo opening document: <PTCoordinatedDocument: 0x2828aae00> fileURL: file:///var/mobile/Containers/Data/Application/6830EDC5-F776-4BEF-8C30-046BCA1F2DF0/Documents/Processed%20Files/624cbc1e-a7c5-4c0d-8937-b0a00013b2a9.pdf The third-party app will immediately prompt the user to save the file, but regardless, the copy is now beyond the purview of our app so we can no longer see any changes made to it. The only workaround is to have the user explicitly share the file from the third-party app back to our app (we have the code in place to handle this), but much preferred the seamless "open-in-place" integration which did not require this. There have been vague allusions to changes in the file system in iOS 17, but we have not been able to find primary sources or much specific detail. For example: https://developer.apple.com/forums/thread/733642 https://developer.apple.com/forums/thread/737971 Are there specific changes in iOS 17 that invalidate our strategy? Are there any other things we may be missing that are needed to make this work? Note, for further reference, this issue is described in Xamarin terms here.. Although, yes, we are Xamarin developers so do not have native code to show, we (and, based on the comments, the Xamarin devs) suspect that this is most likely due to a change in iOS rather than in Xamarin.
Posted
by gso-sq.
Last updated
.
Post not yet marked as solved
0 Replies
366 Views
I'm getting the following error message on on iOS 17.1 and Xcode 15.0.1 The view service did terminate with error: Error Domain=_UIViewServiceErrorDomain Code=1 "(null)" UserInfo={Terminated=disconnect method} In my info.plist I have given access to all file related permissions to rule out any issues Supports opening documents in place -> YES #if os(iOS) .fileImporter(isPresented: $isiOSFilePickerShown, allowedContentTypes: [.item], allowsMultipleSelection: false, onCompletion: { result in do{ guard let selectedURL: URL = try result.get().first else { return } guard selectedURL.startAccessingSecurityScopedResource() else { return } //Some operation with selectedURL } catch let e{ print("error reading file \(e)") } }) #endif
Posted Last updated
.
Post marked as solved
4 Replies
666 Views
I am developing a cloud-based application and have integrated the FileProviderExtension. However, files larger than 20 MB are not uploading, as it's throwing a memory limit exception. Error: Thread 28: EXC_RESOURCE (RESOURCE_TYPE_MEMORY: high watermark memory limit exceeded) (limit=20 MB)
Posted Last updated
.
Post not yet marked as solved
0 Replies
363 Views
Hello, I'm working on an iOS app called "scribe-frontend-ios," and I'd like to change the default folder name that the app creates in the Files app on iOS. Currently, when the app saves files to the Files app, they all go into a folder named "scribe-frontend-ios." However, I want to just call this folder Scribe. I've tried modifying the Info.plist file in my Xcode project by adding the "NSFileProviderServiceName" key with a custom folder name, but it doesn't seem to have any effect. I've also set "LSSupportsOpeningDocumentsInPlace" to true to indicate that my app supports opening documents in place. Can someone please provide guidance on how to change the default folder name for the app in the Files app? Is there a step I might be missing, or is there another way to achieve this? Any help or advice would be greatly appreciated. Thank you!
Posted
by Tyrin.
Last updated
.
Post not yet marked as solved
0 Replies
491 Views
Can these FIFinderSync and NSFileProviderReplicatedExtension work together? My app contains FIFinderSync Extension for files and folders to show Overlay icons. Recently I implemented FileProviderExtension to get the power of cloudsync. As both of them are bundled at the same location Contents/PlugIns/. Only the FileProviderExtensions work. Both have the same NSExtensionPointIdentifers, one uses com.apple.findersync while another one com.apple.fileprovider-nonui. Is this a limitation or what do I need to do so that both work together? Edit: I just noticed, FinderExt and FileProviderExt keeps switching/swapping in between. So both work in parts. But not together.
Posted Last updated
.
Post not yet marked as solved
1 Replies
343 Views
For a new file creation, we need to throw NSFileProviderError(.cannotSynchronize) but we need the file provider to use our identifier instead of the file provider's default identifier (Say 'fp_{RandomID}'). So, we tried giving the NSFileProviderItem object created with our identifier in the completion handler of the createItem function and set the error field with NSFileProviderError(.cannotSynchronize). But this would create another item in the finder with a name suffixed with '2'(Say 'FileName 2') but the temporary File Provider Identifier and the filename(Say 'FileName') of this NSFileProviderItem object are the same as the previous one. Only the finder and the URL fetched using FileManager.getUserVisibleURL function shows 'FileName 2'. Why is this behaviour happening? Why can't the file provider use the identifier given by the main app? What is the proper way to throw an error in the createItem function but to use the given custom identifier for the item instead of the FP default identifier so that the FP should use the custom identifier in future references? Thanks.
Posted
by Kalidoss.
Last updated
.
Post not yet marked as solved
1 Replies
425 Views
I have applied content policy as "downloadEagerlyAndKeepDownloaded" on the folder which i want to materialise (want to implement windows similar feature Always keep on this device feature in mac os in FileProvider). For root item the policy is downloadLazily and for rest of the item it is inherited. The issue i am facing is, while dematerialising the folder, the file provider'e evictItem api is continuously failing with resource busy error though there is no file from that folder in an open state. And it keeps giving the same error and unable to dematerialise that folder.
Posted
by apjoshi.
Last updated
.
Post not yet marked as solved
1 Replies
338 Views
I am running a similar code in FileProvider extension, which throws an notAuthenticated error if the user is not logged in. How do I make user to launch the parent app for the authentication? func enumerateItems(for observer: NSFileProviderEnumerationObserver, startingAt page: NSFileProviderPage) { if(isSignedOut){ observer.finishEnumeratingWithError(NSFileProviderError(.notAuthenticated)) return } } And in the Finder it shows The right corner has Sign in button how do get action control of that button?
Posted Last updated
.
Post not yet marked as solved
0 Replies
285 Views
Using the File Provider API on macOS, I would like to ensure that renaming or moving an item locally wins when the same item is conflictingly deleted remotely. The default behavior seems to be that the delete wins in these two scenarios (compared to local edits, where the item is recreated in response to the conflict (createItem is called following the enumeration of the remote deletion)). Is there a way for my file provider to indicate that the system should recreate the now modified item following my handling of the deletion? The intended behavior can be observed with iCloud, by taking your Mac offline and renaming or moving an item. Before bringing the Mac back online, permanently delete the same item from another device. Many thanks.
Posted Last updated
.
Post not yet marked as solved
0 Replies
412 Views
The goal is to get the current directory when user is browsing and get the updates from the server and populate using enumerateChanges. There is no trigger natively from FileProvider Extension that I can make use of, if there is anything I missed please let me know. I have also tried FInderSyncExtension and pointed it to the CloudStorage path, while it worked flawlessly in the other location but not in CloudStorage location ~/Library/CloudStorage/***-YYY So, how do I get notified when user is browsing in my FileProvider Folders?
Posted Last updated
.
Post not yet marked as solved
1 Replies
414 Views
Hello Everyone, I'm trying to add badges to files in my File Provider Extension for macOS. I'm not trying to create my own Item decorations here, but use the default Icons provided by apple (such as com.apple.icon-decoration.badge.heart , com.apple.icon-decoration.badge.pinned). I've gone through the Sample code provided by Apple for Fruit Basket. I've tried to replicate the same thing in my Extension as well but It seems I'm unable to display Icons. I'm not even getting any Error when the Icons are not being displayed, So I've been stuck for a month on this. These are the Things that I've done below: Folder Structure : FileExplorer |- FileProviderApp | |- UI.swift | |- ContentView.swift |- Extension |- extension.swift |- item.swift |- enumerator.swift |- info.plist According to the instructions given in the Documentation for Decorations here : https://developer.apple.com/documentation/fileprovider/nsfileprovideritemdecorating. The implementation was done as follows: content inside info.plist of the File provider Extension <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>NSExtension</key> <dict> <key>NSExtensionFileProviderSupportsEnumeration</key> <true/> <key>NSExtensionPointIdentifier</key> <string>com.apple.fileprovider-nonui</string> <key>NSExtensionPrincipalClass</key> <string>$(PRODUCT_MODULE_NAME).FileProviderExtension</string> <key>NSFileProviderDecorations</key> <array> <dict> <key>BadgeImageType</key> <string>com.apple.icon-decoration.badge.heart</string> <key>Category</key> <string>Badge</string> <key>Identifier</key> <string>$(PRODUCT_BUNDLE_IDENTIFIER).heart</string> <key>Label</key> <string>Heart Item</string> </dict> </array> </dict> </dict> </plist> In my extension's NSFileProviderItem I've also Implemented the protocol NSFileProviderItemDecorating. and the decoration's method as static let decorationPrefix = Bundle.main.bundleIdentifier! static let heartDecoration = NSFileProviderItemDecorationIdentifier(rawValue: "\(decorationPrefix).heart") var decorations: [NSFileProviderItemDecorationIdentifier]? { var decos = [NSFileProviderItemDecorationIdentifier]() decos.append(Item.heartDecoration) return decos } I was expecting to see badges on the File items in Finder, but i got nothing. When I modified the FruitBasket Project to do the same i was able to see badges, but not when I try to implement it in my Extension. Was I missing a step or is the issue something else ?
Posted Last updated
.
Post not yet marked as solved
4 Replies
952 Views
Crash in fileproviderctl Invoking fileproviderctl from the Terminal.app results in crash. ot@wpg-img-mbp bin % fileproviderctl --help zsh: killed fileproviderctl --help Checked the Device log for more details, and found this, default 10:35:47.810676+0530 kernel mac_vnode_check_signature: /usr/bin/fileproviderctl: code signature validation failed fatally: When validating /usr/bin/fileproviderctl: dynamic: com.apple.fileproviderctl disallowed without com.apple.private.amfi.version-restriction entitlement default 10:35:47.810733+0530 kernel proc 58397: load code signature error 4 for file "fileproviderctl" default 10:35:47.811297+0530 kernel ASP: Security policy would not allow process: 58397, /usr/bin/fileproviderctl default 10:35:47.811420+0530 kernel fileproviderctl[58397] Corpse allowed 1 of 5 default 10:35:47.828366+0530 ReportCrash Formulating fatal 309 report for corpse[58397] fileproviderctl default 10:35:47.838691+0530 osanalyticshelper creating type 309 as /Users/ot/Library/Logs/DiagnosticReports/.fileproviderctl-2023-09-14-103547.ips default 10:35:47.852670+0530 osanalyticshelper Saved type '309(<private>)' report (25 of max 25) at /Users/ot/Library/Logs/DiagnosticReports/fileproviderctl-2023-09-14-103547.ips default 10:35:47.853184+0530 ReportCrash client log create type 309 result success: /Users/ot/Library/Logs/DiagnosticReports/fileproviderctl-2023-09-14-103547.ips default 10:35:47.853323+0530 ReportCrash no MetricKit for process fileproviderctl type 309 bundleId (null) default 10:35:47.852983+0530 osanalyticshelper xpc log creation type 309 result success: /Users/ot/Library/Logs/DiagnosticReports/fileproviderctl-2023-09-14-103547.ips And also found the fileproviderctl in the Crash DiagosticsReports, looks like a codesigning issue. I'm not sure how I got into this issue, but I need this to be fixed. Any help is appreciated! Added the Crash Report and Device Information below, Crash Report of fileproviderctl Crash Report Device Information
Posted Last updated
.
Post not yet marked as solved
1 Replies
342 Views
I want my app to open a folder and read (optionally edit) the files inside it. From the SwiftUI documentation it looks like DocumentGroup might be a good solution since I wouldn't need to manually handle the bookmarks / permissions. How do I use DocumentGroup for this? The following code crashes upon startup: DocumentGroup( editing: CodeRepository.self, contentType: .directory ) { Text("editor view") } To be clear this is to open an view any user selected folder. Not a folder with a custom file extension.
Posted Last updated
.
Post not yet marked as solved
2 Replies
2.9k Views
I have created working fileprovider, that works perfectly on my local machine. Codesigned in xcode, with our company sign certificate as Developer ID Application. No provisioning profile. Also notarized result dmg. Works as expected on my local machine. But won't load on any other machine. Calling [NSFileProviderManager addDomain: ...], ends up with error: Error Domain=NSFileProviderErrorDomain Code=-2001 "The application cannot be used right now." UserInfo={NSLocalizedDescription=The application cannot be used right now.} Code=-2001 should mean, that no file provider manager extension was found in an app bundle. I have made a TestFileProvider application that is totally simplified File Provider example. This too does work only on my own machine. Relevant code from app: - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { NSFileProviderDomain* fileProviderDomain = [[NSFileProviderDomain alloc] initWithIdentifier:@"com.xxxxx.dwc.FileProvider" displayName:@"TestDomain"]; [NSFileProviderManager addDomain:fileProviderDomain completionHandler:^(NSError * _Nullable error) { if (error) NSLog(@"add domain: %@", error); else NSLog(@"add domain SUCCESS"); }]; } There are also these errors, that are related, but I do not understand what are they implying neither how to fix: kernel Sandbox: fileproviderd(448) deny(1) file-read-data /Applications/TestFileProvider.app fileproviderd [ERROR] PluginRecord doesn't have container url for fileproviderd [WARNING] No provider found with identifier (null) for calling bundle (null) on second attempt. I'm clueless on how to fix this. Is this related to codesign ? Or is it necessary to start fileprovider with different method call ?
Posted
by Markel.
Last updated
.
Post not yet marked as solved
0 Replies
302 Views
I am developing a FileProvider extension which will be launched for one or more domains. In the case where I have two domains, say with displayNames "Foo" and "Bar", the finder will then show "MyExtension - Foo" and "MyExtension - Bar" respectively after registering them with addDomain. However, if I only have a single domain, let's say "Foo" – then I just see "MyExtension" rather than "MyExtension - Foo". Now ideally I'd like to be able to control the entire name, but barring that at least be able to show the displayName even with a single domain. How can I achieve that?
Posted
by lerno.
Last updated
.
Post not yet marked as solved
1 Replies
430 Views
Currently, we are doing it by: Calling the function 'signalEnumerator' with the identifier as workingset Returning the metas of the new changes to the function enumerateChanges called by the file provider Sometimes, it would take more time to get the enumerateChanges function call from the file provider after invoking the signalEnumerator function. So, Kindly let us know if is there any other alternative to pass the new updated items information to the file provider properly and quickly.
Posted
by Kalidoss.
Last updated
.
Post not yet marked as solved
0 Replies
331 Views
We are developing File Provider for macOS. We followed apple sample app, and are able to create a File Provider with Container app and an extension. We are able to get this working while building from Xcode. But the distributable build does not load the extension and fails with error "Application can not be loaded". We need help with understanding root cause of the issue, and exact entitlement that we can use for creating distributable builds.
Posted
by mital.
Last updated
.