如何修复 macOS 的 AppStore 拒绝 "Your app requests admin access in order to function"

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

我目前正在开发一个包含嵌入式 XPC 服务的应用程序。

应用程序在后台启动并与XPC 服务通信,以便服务不时移动鼠标。

我的 Apple 应用评论返回了这个:

准则 2.4.5(v) - 性能

您的应用需要管理员权限才能运行。

- 应用程序需要辅助功能才能运行。

资源

我们的 WWDC 2019 会议提供了有关请求用户访问的信息视频。请观看 macOS 安全方面的进步视频。

AppDelegate.swift

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

MyHelperXPC.swift(XPC 服务目标)

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

调用函数 'activate' 时,将显示此对话框:

用户现在必须解锁安全和隐私首选项并检查我的应用程序。 在此之后,我的应用程序现在可以毫无问题地移动鼠标了。

XPC 服务 Info.plist 包含:

com.apple.security.app-sandbox = 1

应用程序 Info.plist 包含:

应用程序仅在后台运行 = 是

问题是,我怎样才能更好地理解这个 App Store 拒绝并修复它?

我的应用程序和 XPC 服务已使用 Developer ID 应用程序签名。

我正在使用 Xcode 12.4、macOS Big Sur 和 swift 5,未使用框架。

向 Apple Review Board 申诉后,发现使用 Accessibility 移动鼠标被认为是不合适的。

我知道以这种方式使用辅助功能会利用最初设计用于让人们更容易访问您的应用的功能。

他们还写道,将研究具有相同功能的其他应用程序,因为它们也可能被认为不合适。