title: Difference between AXIsProcessTrustedWithOptions and NSWorkspace openURL for changing accessibility
body: <p>To be able to use certain features, users need to enable apps in accessibility panel. There are two ways to bring up the page shown as below</p>
  
  <p>Solution 1</p>
  
  <pre><code>NSDictionary* options = @{static_cast&lt;id&gt; (kAXTrustedCheckOptionPrompt): @YES};
  return AXIsProcessTrustedWithOptions(static_cast&lt;CFDictionaryRef&gt; (options));
  </code></pre>
  
  <p>Solution 2</p>
  
  <pre><code>NSString* urlString = @"x-apple.systempreferences:com.apple.preference.security?Privacy_Accessibility";
  [[NSWorkspace sharedWorkspace] openURL: [NSURL URLWithString:urlString]];
  </code></pre>
  
  <p>Compared to solution 1, solution 2 doesn't require the explaining dialog which introduces one extra click. And this is the main reason I prefer using solution 2.</p>
  
  <p>But what I find is sometimes the app I enabled is not recognized by the system using solution 2. Because sometimes even if the app is enabled in accessibility panel, when I start the bundle which would spawn another child process, the standard error outputs something like "assitive device does not trust this process".</p>
  
  <p>Does solution 1 do some hidden tricks while solution 2 doesn't?</p>