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

Posts under File Provider tag

60 Posts
Sort by:
Post not yet marked as solved
1 Replies
367 Views
Now, I have created an extension via the fileprovider template and adopts fileprovider protocols. But when i download a file, the system throws the error: "Couldn't communicate with helper application". From the system log i can see that the fetch-content failed with such error: ┳139b4 ‼️ done executing <FP2 ‼️ fetch-content(a file 1) why:materialization|itemChangedRemotely sched:userInitiated.1647482996.810533#1647482996.810533 error:<NSError: Cocoa 4101 "Couldn't communicate with helper application." Underlying={NSError: POSIX 2 "couldn't issue sandbox extension com.apple.app-sandbox.read-write for '/f/db641e9a04e144c6b320': No such file or directory" }}>> Any advise would be appreciated, thanks!
Posted
by feiniks.
Last updated
.
Post marked as solved
2 Replies
287 Views
I've added file provider extension target to my macOS app. From the app I call NSFileProviderManager.add() to add my extension domain. Unfortunately this call fails with a mysterious error message: Domain=NSFileProviderErrorDomain Code=-2001 "The application cannot be used right now."  I'm looking for a possible cause for this error. My app is not sandboxed, but extension is. The app and extension share the same application group.
Posted Last updated
.
Post not yet marked as solved
0 Replies
217 Views
I've run into some issues using an app called StrongSync, which uses the FileProvider API to mount various cloud services. The mounted folder was showing stale results and missing content. In attempting to troubleshoot, I uninstalled and reinstalled, deleted and recreated the connection multiple times, but it simply does not appear in Finder, and a folder does linger in ~/Library/CloudStorage even with no folders configured. The company that authors the software has been unresponsive. Is there a command or API call to remove/reset that folder in CloudStorage?
Posted
by jaraco.
Last updated
.
Post not yet marked as solved
2 Replies
441 Views
Dear all, we are developing a File Provider Extension that synchronises files and folders across devices using our custom upload/download server. We have noticed that every file written in the temp folder of the extension have the quarantine flag set, thus avoiding any app or executable to be launched from the folder itself. Specifically in each file we see those Quarantine Keys: ["LSQuarantineIsOwnedByCurrentUser": 1, "LSQuarantineTimeStamp": 2022-03-03 16:30:54 +0000, "LSQuarantineAgentName": XXXXX, "LSQuarantineType": LSQuarantineTypeSandboxed] We also tried the following: LSFileQuarantineEnabled = NO in the info.plist com.apple.security.files.user-selected.executable = true in the entitlements (in the main app and extension target) We tried in the application to use the following swift code: var resourcevalues = URLResourceValues() resourcevalues.quarantineProperties = nil try self.setResourceValues(resourcevalues) We didn't get any error using the code above, but the quarantine flag is still present. All without success. Only using this command everything works sudo xattr -dr com.apple.quarantine path/to/AppOrExecutable which, of course, is not feasible. Any help on this?
Posted
by sgalizia.
Last updated
.
Post not yet marked as solved
0 Replies
242 Views
Hi, I'm now working with FileProvider on MacOS11.6. I find out that I need to add icons and export it as UTI in Containing App of FileProvider if I want to show some icon decoration on my items that under the control of FileProvider. But I just encountered some difficulties: As title says, once an UTI being exported with arbitrarily identifier, I cannot cancel the exporting and then re-export another image with the same identifier for the need of changing image but remaining identifier unchanged. My icon decoration somehow stops to show on items but it normally shows corresponding decoration identifier when evaluated by fileproviderctl evaluate {item_path} and changing identifier did not help. Both difficulties were not solved by follow steps I've tried: Force restart Finder Delete domain before restart FileProvider Use pluginkit -r to remove FileProvider before restart FileProvider Any advise would be appreciated, thanks!
Posted
by minlee.
Last updated
.
Post marked as solved
1 Replies
270 Views
I am working on uploading pdf file to server using UIDocumentPicker. It selects the file correctly but while fetching the file content it is throwing this error: Fatal error: 'try!' expression unexpectedly raised an error: Error Domain=NSCocoaErrorDomain Code=257 "The file “file-sample_150kB.pdf” couldn’t be opened because you don’t have permission to view it." UserInfo={NSFilePath=/private/var/mobile/Library/Mobile Documents/com~apple~CloudDocs/Downloads/file-sample_150kB.pdf, NSUnderlyingError=0x28225c5a0 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}} Here my code for uploading file to server. func uploadDocumentRequest(targetVC : UIViewController, args: [String : String], url: URL) { let boundary = generateBoundaryString() var body = Data() for (key, value) in args { body.append(Data("--\(boundary)\r\n".utf8)) body.append(Data("Content-Disposition: form-data; name=\"\(key)\"\r\n\r\n".utf8)) body.append(Data("\(value)\r\n".utf8)) } let filePathKey = "file" let filename = "doc_file.pdf" let fileData: Data = try! Data(contentsOf: url) let mimetype = "application/pdf" body.append(Data("--\(boundary)\r\n".utf8)) body.append(Data("Content-Disposition: form-data; name=\"\(filePathKey)\"; filename=\"\(filename)\"\r\n".utf8)) body.append(Data("Content-Type: \(mimetype)\r\n\r\n".utf8)) body.append(fileData) body.append(Data("\r\n".utf8)) body.append(Data("--\(boundary)--\r\n".utf8)) let url = URL(string: BASE_URL + "scripts/ajaxEntryPoint.php")! var request = URLRequest(url: url) request.httpMethod = "POST" request.setValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type") request.httpBody = body let configuration = URLSessionConfiguration.default let session = URLSession(configuration: configuration, delegate: self, delegateQueue: OperationQueue.main) let task = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) in guard let _:Data = data else { return } let json:Any? do { json = try JSONSerialization.jsonObject(with: data!, options: []) } catch { return } guard let server_response = json as? NSDictionary else { return } print(server_response) }) task.resume() } Error shows up on this line: let fileData: Data = try! Data(contentsOf: url) Thanks in Advance Nabeel
Posted
by chknabeel.
Last updated
.
Post not yet marked as solved
2 Replies
304 Views
When exposing mounted volumes on a network, the user expects drag&drop to default to copy (not move from local disk). This UX is kind of standardized when connecting a thumb drive or usb ssd drive. So I find it confusing why we can't define in FileProvider the UTTypeVolume to ensure the user gets a more expected copy-on-drag behavior. Please let me know if there are ways to achieve this that I've missed. i.e. I want both "drag to" & "drag from" a file provider volume to result in the green "+" (without having to teach the user to hold the alt-key)
Posted
by jomentino.
Last updated
.
Post not yet marked as solved
2 Replies
273 Views
Hi, I'm working on something that is not a cloud-sync utility. I'd like to hide/remove the cloud icons that show up default with FileProvider. The mount should mimic the behaviour of any attached usb-volume, so all features like "auto-mirror" / cache is something I want to disable. Instead the user should simply see the files and be able to drag & drop them to or from a folder on their Mac to the mounted FileStream volume. Please let me know if there are ways to do this to simplify the UX for the user. Thanks joemet
Posted
by jomentino.
Last updated
.
Post not yet marked as solved
1 Replies
293 Views
Hello, I'm developing a FileProvider extension for MacOS where I want the default Drag and Drop behaviour to be Copy instead of Move. If one removes .allowsReparenting from NSFileProviderItemProtocol.capabilities this will make Copy being used when moving files out of the provider but when moving files in to the provider they are still being Moved. Is there any way to control this behaviour? Essentially I always want files to be Copied instead of Moved when Dragging and Dropping files in and out of the extension making it behave more like a mounted volume. Thanks!
Posted
by hannseman.
Last updated
.
Post not yet marked as solved
2 Replies
303 Views
Hi, When using FileProvider, files visualised in Finder does not trigger a download to visualise or audition the file when hitting space (for quicklook) Can this be configured somehow?
Posted
by jomentino.
Last updated
.
Post marked as solved
3 Replies
432 Views
Hi, I am new to macOS development. I am trying to develop macOS FileProvider extension, and everything was fine until I updated my macOS from 11 to 12.2. After updating OS, FileProvider extension won't being loaded by NSFileProviderManager.add(domain) and its completion handler returns error - NSFileProviderDomain.Error.providerNotFound @IBAction func tapAddDomainButton(_ sender: Any) { NSFileProviderManager.add(domain) { error in print("Add domain error: \(error)") // <- Error: Optional(Error Domain=NSFileProviderErrorDomain Code=-2001 "The application cannot be used right now." UserInfo={NSLocalizedDescription=The application cannot be used right now.}) } } I've made a new boilerplate project with default macOS > App + 'File Provider Extension' in Xcode, and still got same error. Same code works on macOS 11.6.1 Weird thing is that apple sample code won't return error and still works in macOS 12.2. I can't find any difference between my code and apple sample. Apple Sample Code I uploaded my test project here. Please help Thanks in advance.
Posted
by logoutnow.
Last updated
.
Post not yet marked as solved
2 Replies
520 Views
Hi all, I'm working on a FileProvider extension and I'm getting kind of lost. My questions: The working set of the app is local, offline and shouldn't contact the cloud. Do I build a working set on-device, or should I -after login- collect all working set data and cache it on device and signal a change to the working set? My assumption is that I don't save folder nodes to disk when enumerated from the cloud, but only the actual files, is that correct? Thanks in advance and have a wonderful day!
Posted Last updated
.
Post marked as solved
1 Replies
313 Views
After I receive an apns request. func enumerateItems(for observer: NSFileProviderEnumerationObserver, startingAt page: NSFileProviderPage) will be called. And I start fetch new items from my server. If new items have been deleted something that old items which already showed to the user contains. These have been deleted items will not disappear on the screen. func enumerateItems(for observer: NSFileProviderEnumerationObserver, startingAt page: NSFileProviderPage) {         task = Task {             do {                 let flat = MediaItemReference.flat(enumeratedItemIdentifier == .rootContainer ? root : enumeratedItemIdentifier.rawValue)                 guard let uuid = UUID(uuidString: flat.identifier) else {                     observer.finishEnumeratingWithError(FileProviderError.other)                     return                 }                 let fileContents = try await WebApi.getSubForFileProvider(uuid)                 let refs = fileContents.map { fileContent -> MediaItemReference in                     InfoPool.shared.set(fileContent.uuid.uuidString, value: fileContent)                     return MediaItemReference(                         identifier: fileContent.uuid.uuidString,                         isDirectory: fileContent.isDictionary,                         filename: fileContent.name,                         father: uuid.uuidString)                 }                 let items = refs.map(FileProviderItem.init(reference:))                 observer.didEnumerate(items)                 observer.finishEnumerating(upTo: nil)             } catch {                 print("=>", error.localizedDescription)                 observer.finishEnumeratingWithError(error)             }         }     }
Posted
by ZhuHaoyu.
Last updated
.
Post not yet marked as solved
0 Replies
200 Views
What is the difference between NSFileProviderWorkingSetContainerItemIdentifier and NSFileProviderRootContainerItemIdentifier. And what NSFileProviderWorkingSetContainerItemIdentifier is? What time will files app create NSFileProviderWorkingSetContainerItemIdentifier?
Posted
by ZhuHaoyu.
Last updated
.
Post not yet marked as solved
1 Replies
316 Views
I'm writing an app that, among other things, need to be able to play several tracks using AvAudioEngine. My question is about the best practice for carrying with the App a set of tracks. I could 'bundle' them with the app but currently they are about 400MB and I think it's too much. I think that this would also significantly slow my deploy times every time I need to run/debug the app. On my iPad Pro, using the File app, I can see the 'On My iPad' folder and inside that folder I already see some folders used by others App, like Cubasis LE, Acrobat and GarageBand for iOS. I can't find any example that shows me how to access these locations and which capability I need to add to my app (if any). Can you please point me in the right direction? Thanks, Guglielmo
Posted
by Guglielmo.
Last updated
.
Post not yet marked as solved
1 Replies
639 Views
I work on a cloud sharing solution and I am trying to make some directories read only. I have used "fileSystemFlags" and "capabilities" properties in the NSFileProviderItemProtocol to enforce read only behaviour but it only works when the user is drag and dropping in finder. How can I really make a folder readonly using the file provider extension? I tried to create file/folder from Finder or Terminal it gives permission denied(as expected). However, sudo mkdir created a folder from terminal either way :(. I noticed this is the same behaviour in iCloud Drive unfortunately. Since these are folders/files shared by someone else even with sudo rights user should not be allowed to create or modify files. Can read onlyness be achieved with extended attributes or some other ways? Thank you
Posted
by centea.
Last updated
.
Post not yet marked as solved
4 Replies
517 Views
I have had 2 apps in the store for several years now.  Unfortunately, I have never been able to advertise. They were supposed to be 2 separate apps. The English and the Spanish version. They were incorrectly loaded as one - English and Italian languages - not Spanish. In addition, I have no access to my files. My questions are: can I replace these apps with a newly created version with same Titles? My new version is huge - what is the maximum file size for interactive eBook or IOS Apps?
Posted
by Grandmop.
Last updated
.
Post not yet marked as solved
0 Replies
216 Views
I have a files provider app that seems to be working perfectly except for one thing. If I have a directory open in the files provider app and then put the app into the backround and while in the background a file is renamed in the open directory via some other app, then when the files app comes back into the foreground it shows the file with the old name as well as the new name. I can see via logging that the FileproviderEnumerator is being closed when the app is moved to the background and then reopened when it is moved back into the foreground and I can also see that the correct file names are loaded into it when enumerating. It looks like the files app doesn't check to see if what it currently has in its cache matches what was just loaded and remove anything that is missing. To make it more confusing this only appears to be a problem on some devices and not others. It is a problem on my iPad running iPadOS 15.2.1. I have tried having the parent app, which did the file rename send a change notification but that doesn't seem to work either. If I call the following in my app: [NSFileProviderManager.defaultManager signalEnumeratorForContainerItemIdentifier:identifier completionHandler:^(NSError * _Nullable error){ if (error != nil) NSLog(@"signalEnumeratorForContainerItemIdentifier error:%@", error); else { NSLog(@"signalEnumeratorForContainerItemIdentifier OK"); } }]; I see the following message in the console log from the fileproviderd: [DEBUG] Received error NSError: Cocoa 3072 "" while sending didChangeItemID:completionHandler: on behalf of myApp[955] Do I need to explicetly tell the files app when a file has been deleted or renamed?
Posted
by BarryL.
Last updated
.