file provider does not get loaded on addDomain

I have created working fileprovider, that works perfectly on my local machine. Codesigned in xcode, with our company sign certificate as Developer ID Application. No provisioning profile. Also notarized result dmg.

Works as expected on my local machine. But won't load on any other machine. Calling [NSFileProviderManager addDomain: ...], ends up with error: Error Domain=NSFileProviderErrorDomain Code=-2001 "The application cannot be used right now." UserInfo={NSLocalizedDescription=The application cannot be used right now.}

Code=-2001 should mean, that no file provider manager extension was found in an app bundle.

I have made a TestFileProvider application that is totally simplified File Provider example. This too does work only on my own machine.

Relevant code from app:

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
	NSFileProviderDomain* fileProviderDomain = [[NSFileProviderDomain alloc] initWithIdentifier:@"com.xxxxx.dwc.FileProvider" displayName:@"TestDomain"];
	
	[NSFileProviderManager addDomain:fileProviderDomain completionHandler:^(NSError * _Nullable error) {
		if (error)
			NSLog(@"add domain: %@", error);
		else
			NSLog(@"add domain SUCCESS");
	}];
}

There are also these errors, that are related, but I do not understand what are they implying neither how to fix:

kernel Sandbox: fileproviderd(448) deny(1) file-read-data /Applications/TestFileProvider.app

fileproviderd [ERROR] PluginRecord doesn't have container url for

fileproviderd [WARNING] No provider found with identifier (null) for calling bundle (null) on second attempt.

I'm clueless on how to fix this. Is this related to codesign ? Or is it necessary to start fileprovider with different method call ?

Update: I find out, that issue is around this log line: kernel Sandbox: fileproviderd(448) deny(1) file-read-data /Applications/TestFileProvider.app

What I found out, is that file provider is not loaded only when I run my application from /Applications/ folder If run in Xcode project build folder, or ˜/Desktop, there is no issue.

I have tried changing everything that I can think of in codesign, sandbox and other build settings, but nothing changes that

Hi Markel, could you please file a Feedback through Feedback Assistant? And include a sysdiagnose + timestamp of your reproduction of the issue. Thanks!

Any update on this issue? I'm facing the same exact issue when I create a distribution package.

I too faced the same exact issue ie. when I was running my app from the '/Applications' folder, my file provider wasn't started and got the exact error "The application cannot be used right now". After doing a lot of trial and error, I found that the app-id and group-id keys in entitlements should be set with the prefix 'teamIdentifier' for example: {teamIdentifier}.{existing-group-id}.

The necessary conditions are:

  1. Your main app and file provider extension should be signed with entitlements that must contain the below keys (Not about the Info.plist keys):
  • key1 - 'com.apple.application-identifier', sample value - '{teamIdentifier}.{BundleIdentifier}'
  • key2 - 'com.apple.security.application-groups', sample value - '{teamIdentifier}.{groupIdentifier}'
  1. Then, in your file provider extension, set the value '{teamIdentifier}.{groupIdentifier}' you used in the above key 'application-groups' to the 'NSExtensionFileProviderDocumentGroup' key in the extension's Info.plist.

The above two things resolved the issue to me and IDK whether the above solution is the proper one or not but I suspect using the teamIdentifiers in the entitlements would set proper permissions for both our main app and the extension.

If someone knows the exact solution or exact reason for the working of above steps, let us know.

Thanks.

file provider does not get loaded on addDomain
 
 
Q