macOS 12.2 FileProviderExtension won't be loaded

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.

Answered by logoutnow in 704733022

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.

Additional info: My colleague tested in macOS 12.0.1 and my test project works fine.

I think I managed to this problem.

The key point is AppGroup. FileProvider requires AppGroup capabilities.

I think that a step to reproduce the issue likes below.

  1. Launch provider without AppGroup at first time, and face the FileProvider error.
  2. Add AppGroup capabilities and relaunch.
  3. Still got the error.

New project with adding AppGroup capabilities at first launch won't fail.

Accepted Answer

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.

macOS 12.2 FileProviderExtension won't be loaded
 
 
Q