I am trying to get the File Provider extension to work on macOS 10.15 Beta 7 (19A546d) with Xcode 11 Beta (11M392r) so far did not manage to get it to launch with a sample project. The documentation is very lacking and there must be something I missed.
I have a Mac app that does the following on launch:
let domain = NSFileProviderDomain(identifier: NSFileProviderDomainIdentifier(rawValue: "com.app.testfileprovider"), displayName: "TestFileProvider", pathRelativeToDocumentStorage: "")
NSFileProviderManager.add(domain) { error in
if let error = error {
NSLog("Could not add file provider for domain: \(error)")
return
}
guard let newManager = NSFileProviderManager(for: domain) else {
NSLog("Could not create file provider manager.")
return
}
self.manager = newManager
NSLog("File provider URL: \(newManager.documentStorageURL.path)")
}
I sometimes get this error, not sure why:
Could not add file provider for domain: Error Domain=NSFileProviderInternalErrorDomain Code=3 "The value “com.myappbundleid” is not valid for the parameter “callerBundleID”." UserInfo={NSLocalizedDescription=The value “com.myappbundleid” is not valid for the parameter “callerBundleID”.}
The error may be resolved by a "killall Finder" command in Terminal, then it runs successfully, and outputs:
File provider URL: /Users/[username]/Library/Group Containers/group.com.myappgroup/File Provider Storage
In Finder the “File Provider Storage” folder appears with a cloud badge, which seems to be OK. I guess.
I have my File provider extension class, which is basically the generated code when I added the File provider extension to my Mac app in Xcode:
class FileProviderExtension: NSFileProviderExtension {
var fileManager = FileManager()
override init() {
NSLog("File provider initialized")
super.init()
}
...
Here the “File provider initialized” message is never logged and the extension is never initialized. I cannot get it to launch at all.
In the Console.app this is the only relevant message I could find:
default 09:14:35.447849+0200 *** com.apple.launchservices - 45683955: Checking whether application is managed at file:///Users/laszlo.agardi/Library/Developer/Xcode/DerivedData/FileProviderMacTest-eebpahoydvfxovantvhkplhgrcty/Build/Products/Debug/FileProviderMacTest.app/Contents/PlugIns/FileProviderExt.appex//com.myapp.fptest.FileProviderExt
What I did so far:
- the app and extension are sandboxed, it is set in the entitlements files
- the app and extension share the same app group, also set in entitlements
- Tried to launch the extension:
- Run the file provider from Xcode, Xcode was waiting for the extension to launch
- I opened the File Provider Storage folder in Finder, it has the cloud badge. But no file action inside or just browsing launches the File provider extension
What am I missing? How do I get the File Provider extension to launch on macOS Catalina?