Post

Replies

Boosts

Views

Activity

Reply to Cannot launch new FileProvider extension on macOS 10.15
After checking it out in macOS 11 Beta 4 and Xcode 12 Beta 4: There is no option to add a File Provider extension target to a macOS app The documentation has a macOS support section - https://developer.apple.com/documentation/fileprovider/macos_support but lacks actual documentation on how it should be used The documentation says the NSFileProviderExtension class is only available on iOS Do you have any working sample code? Can someone confirm if this new macOS 11 API is something we can use to build file provider extensions? I also updated my feedback with the latest info: FB7262787
Aug ’20
Reply to Cannot launch new FileProvider extension on macOS 10.15
I managed to get the File Provider extension working with some tricks with Xcode 12.2 RC (Version 12.2 beta 4 (12B5044c)) and macOS 11.0.1 RC (Version 11.0.1 Beta (20B5022a)) You cannot add a File Provider Extension target in Xcode (FB8889071). However it can be worked around by adding a different extension target then modifying the info.plist file accordingly. E.g. I added a Finder Sync Extension then modified the NSExtension part of the info.plist similar to an iOS File Provider Extension: <key>NSExtension</key> <dict> <key>NSExtensionFileProviderDocumentGroup</key> <string>group.com.yourappgroup</string> <key>NSExtensionFileProviderSupportsEnumeration</key> <true/> <key>NSExtensionPointIdentifier</key> <string>com.apple.fileprovider-nonui</string> <key>NSExtensionPrincipalClass</key> <string>$(PRODUCT_MODULE_NAME).FileProvider</string> </dict> I’m not sure if all these keys are needed, but I guess the NSExtensionPointIdentifier and NSExtensionPrincipalClass must be set. The NSExtensionPrincipalClass value must be set to the class that implements the NSFileProviderReplicatedExtension protocol in your extension target. Then in my app I do the following after launch to set up a file provider: let domain = NSFileProviderDomain(identifier: NSFileProviderDomainIdentifier("com.myapp.fileprovider"), displayName: "MyAppFileProvider") NSFileProviderManager.add(domain) { error in &#9;&#9;print("Add file provider domain: \(error as NSError?)") &#9;&#9;let manager = NSFileProviderManager(for: domain) &#9;&#9;manager?.signalEnumerator(for: .rootContainer, completionHandler: { error in &#9;&#9;&#9;&#9;print("Signal change error: \(error as NSError?)") &#9;&#9;}) } This will add the file provider to the sidebar in Finder. I got this so far, can enumerate items similar to iOS file provider. The way the File Provider Extension should be set up, and how we should work with it is still lacking documentation and an example project.
Nov ’20