swiftmacosapp-storeprivilegesxpc

How to fix AppStore rejection "Your app requests admin access in order to function" for macOS


I'm currently developing an App that contains a XPC Service embedded.

The App starts in background and communicates with the XPC Service in order to make the service move the mouse from time to time.

My app review by Apple returned this:

Guideline 2.4.5(v) - Performance

Your app requests admin access in order to function.

- App requires Accessibility in order to function.

Resources

An informational video concerning requesting access from users is available from our WWDC 2019 conference. See the Advances in macOS Security video.

AppDelegate.swift

func applicationDidFinishLaunching(_ aNotification: Notification) {
connection = NSXPCConnection(serviceName: "com.some.ServiceName")
        connection?.remoteObjectInterface = NSXPCInterface(with: MyHelperXPCProtocol.self)
        connection?.resume()
}

MyHelperXPC.swift (XPC Service Target)

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)
    }
}

When the function 'activate' is called this dialog is shown: Accessibility Dialog

The user now have to unlock Security & Privacy preferences and check my App. After this, my application can now move the mouse without a problem.

Accessibility Check

XPC Service Info.plist contains:

com.apple.security.app-sandbox = 1

App Info.plist contains:

Application is background only = YES

The question is, how can I understand better this App Store rejection and fix it?

My App and XPC Service are signed with a Developer ID Application.

I'm using Xcode 12.4, macOS Big Sur and swift 5, not using frameworks.


Solution

  • After appealing to the Apple Review Board, turned out that moving the mouse using the Accessibility is considered inappropriate.

    I understand that using the Accessibility this way exploits the feature originally designed to make your app more accessible for people.

    They also wrote that will look into other apps that have the same functionality because they may be considered inappropriate as well.