Unable to determine if accessibility permissions were granted for a notarized app.

I develop apps using C sharp in Visual Studio for Mac.

The app was originally granted accessibility permissions, but after it was notarized by Apple, it failed to determine if it was granted permissions.

This is how it is determined in the code.
Code Block
var key = new NSObject[] { FromObject("AXTrustedCheckOptionPrompt") };
var obj = new NSObject[] { FromObject((NSNumber)0) };
var options = NSDictionary.FromObjectsAndKeys(obj, key);
if (!AXIsProcessTrustedWithOptions(options.Handle))
{
//some codes
}


This may or may not occur on different devices.
When I compared the console logs of the devices that this occurred and those that didn't, I noticed the following differences.
Code Block
tccd handle_TCCAccessCopyInformation(): failed to find an Application URL for bundle ID: old.bundle.id.


I recently changed the bundle ID, but the devices seems to refer to the old bundle ID.

By the way, this problem no longer occurs when I reboot the device.
However, I don't want to force users to go through this procedure, so I'm looking for someone who has a solution to this problem.
Depending what you're referring to, LaunchServices has had some weird cache invalidation issues around apps in macOS since Yosemite. A classic case is adding a new document type to an app and the UTI not being recognized when debugged for the first time.
However, this should mostly occur on developer machines, since users will be installing/copying apps in ways that always trigger LaunchServicesD (make an acronym from the capitalized letters since it will be censored by the forum otherwise).
The two most common options are simply touch(1) on the app bundle itself, or the more complicated lsregister found in /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support.
You'd want a command like lsregister -f <APP>.
I've found lsregister -dump really useful if you want to know what the operating system currently "knows" about your app.
Thank you for your answer!!

Hmmm, it's a bug that occurs in many places.
I'm hoping Apple will fix it soon, but I'll try to do so by returning the bundle ID this time.
To avoid the sort of caching that TyngJJ is talking about I test this stuff using a VM. That way I can restore the VM to a fresh snapshot between each test.

My Testing a Notarised Product post has a description of this procedure (its focus is on Gatekeeper but the same process works for TCC).

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
Unable to determine if accessibility permissions were granted for a notarized app.
 
 
Q