title: How to fix AppStore rejection "Your app requests admin access in order to function" for macOS
body: <p>I'm currently developing an App that contains a XPC Service embedded.</p>
  <p>The App starts in background and communicates with the XPC Service in order to make the service move the mouse from time to time.</p>
  <p>My app review by Apple returned this:</p>
  <p><em><strong>Guideline 2.4.5(v) - Performance</strong></em></p>
  <p><em>Your app requests admin access in order to function.</em></p>
  <p><em>- App requires Accessibility in order to function.</em></p>
  <p><em>Resources</em></p>
  <p><em>An informational video concerning requesting access from users is available from our WWDC 2019 conference. See the Advances in macOS Security video.</em></p>
  <p><strong>AppDelegate.swift</strong></p>
  <pre><code>func applicationDidFinishLaunching(_ aNotification: Notification) {
  connection = NSXPCConnection(serviceName: &quot;com.some.ServiceName&quot;)
          connection?.remoteObjectInterface = NSXPCInterface(with: MyHelperXPCProtocol.self)
          connection?.resume()
  }
  </code></pre>
  <p><strong>MyHelperXPC.swift</strong> (XPC Service Target)</p>
  <pre><code>import Foundation
  import Cocoa
  
  @objc class MyHelperXPC: NSObject, MyHelperXPCProtocol {
      func terminateHelper() {
      }
  
      /* This function triggers the dialog informing that the app would like
         to control this computer using accessibility features. */
      func activate(duration: TimeInterval) {
          CGEvent(mouseEventSource: nil, mouseType: CGEventType.mouseMoved, mouseCursorPosition: point, mouseButton: CGMouseButton.left)?.post(tap: CGEventTapLocation.cghidEventTap)
      }
  }
  </code></pre>
  <p>When the function 'activate' is called this dialog is shown:
  <a href="https://i.stack.imgur.com/CXIWb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CXIWb.png" alt="Accessibility Dialog" /></a></p>
  <p>The user now have to unlock Security &amp; Privacy preferences and check my App.
  After this, my application can now move the mouse without a problem.</p>
  <p><a href="https://i.stack.imgur.com/8kzrf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8kzrf.png" alt="Accessibility Check" /></a></p>
  <p><strong>XPC Service Info.plist contains:</strong></p>
  <p>com.apple.security.app-sandbox = 1</p>
  <p><strong>App Info.plist contains:</strong></p>
  <p>Application is background only = YES</p>
  <p><strong>The question is</strong>, how can I understand better this App Store rejection and fix it?</p>
  <p>My App and XPC Service are signed with a Developer ID Application.</p>
  <p>I'm using Xcode 12.4, macOS Big Sur and swift 5, not using frameworks.</p>