Posts

Post not yet marked as solved
27 Replies
Hi @nslx, You have to add a file provider domain from your app using the NSFileProviderManager class. See the example in my previous comment, I believe it has all the details: https://developer.apple.com/forums/thread/122351?answerId=645095022#645095022 Also be sure to keep the Console.app open as it can be very informative with errors.
Post not yet marked as solved
4 Replies
Hello, this is how I got it to launch: https://developer.apple.com/forums/thread/122351?answerId=645095022#645095022
Post marked as solved
4 Replies
If your are using Swift, then you must also include module name when you specify the principal class in the info.plist like this: <key>NSExtensionPrincipalClass</key> <string>$(PRODUCT_MODULE_NAME).FileProvider</string> I also did what you described above and it works for me: https://developer.apple.com/forums/thread/122351?answerId=645095022#645095022
Post not yet marked as solved
27 Replies
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.
Post not yet marked as solved
27 Replies
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
Post not yet marked as solved
27 Replies
Update:In macOS Beta 8 and Xcode 11 GM, NSFileProviderExtension is no longer available to Mac apps. However the documentation says it is available for Mac Catalist apps.When I try to build a Mac Catalyst app with file provider extension I get the error:error: File Provider extensions are not available when building for Mac Catalyst. (in target 'TestFPExtension' from project 'TestFP2')