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.
I also posted the same question on Stackoverflow.
Not only does this require an AppGroup, but also it says that the value of NSExtensionFileProviderDocumentGroup in the Info.plist file must be the same as the AppGroup.