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.
File Provider
RSS for tagAllow other apps to access the documents and directories stored and managed by your containing app using File Provider.
Posts under File Provider tag
85 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
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
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?
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.
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.
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.
Hi there,
Anybody knows a way to make the main Finder icon as well as folder emboss icon dynamic per NSFileProviderDomain ?
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?
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.
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?
FileProvider conflicts: how to have a rename or move operation win when an item is deleted remotely?
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.
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.
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)
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!
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
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.
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?
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.
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
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