这个问题通常与辅助功能有关。您可以确保在AppDelegate的didFinishLaunchingWithOptions函数中启用了辅助功能。例如:
import UIKit
@UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// 启用辅助功能
UIAccessibility.requestGuidedAccessSession(enabled: true) { [unowned self] (bool) in
guard bool == true else { return }
self.window?.rootViewController?.becomeFirstResponder()
}
return true
}
}
这样,您就应该能够找到AXFocusedUIElement了。
下一篇:AXFR > BIND区域传输