How to correctly add accessibility permissions to a program

I'm writing a program that requires accessibility permissions, and I use AXIsProcessTrustedWithOptions to confirm and direct the user to the accessibility interface for authorization. According to conventional implementation, after the accessibility interface is opened, the system will automatically add the corresponding program, and the user only needs to turn on the permissions. But now, with accessibility turned on, I don't see my program loading automatically.

Next, I tried to add it manually, click + on the accessibility interface, select the program I built and then add it. But when I clicked Add, my program was not successfully added. The accessibility interface still did not see my program being loaded, and the user could not open permissions for it.

I think this has nothing to do with whether it is a development version, because I tried other debug programs developed and compiled with xcode and they were able to be added normally. So I want to know, what are the reasons why it cannot be added? Which parts should I check from?

I solved my problem, it seems that the granting of permissions is uniquely confirmed by bundle identifier and product name, and a program with the same bundle identifier and product name previously existed in my environment. Although I deleted the old version of the program, The conflict appears to remain. Therefore, after I modified the bundle identifier and product name of the new program, I was able to successfully authorize it and it ran normally. But I can't confirm whether this is the root cause. If there is a more elegant solution, please suggest it. Grateful!

How to correctly add accessibility permissions to a program
 
 
Q