OGeek|极客世界-中国程序员成长平台

标题: ios - 设置错误消息中未启用 UIAutomation [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-13 13:38
标题: ios - 设置错误消息中未启用 UIAutomation

当我用 [[UIATarget localTarget].frontMostApp isVisible] 在 main.mm 主函数中,我得到异常说

* exception UIAutomation is not enabled on this device. UIAutomation must be enabled in Settings. *

但我已启用设置->开发人员->在设备中启用自动化 UI。 iOS 版本:8.1.2 和 8.0.1 越狱。

 int main(int argc, char **argv, char **envp)
{
    @autoreleasepool {

        @try
        {

            [[UIATarget localTarget].frontMostApp isVisible];

            if ([UIATarget localTarget].springboard.pid == nil)
            {
                return 0;
            }
        }
        @catch (NSException *exception)
        {
            NSLog(@"*** exception %@ ***",exception);
            return 0;
        }
    }
}

我看过这个链接https://github.com/kif-framework/KIF/issues/707以及 UIATarget frontMostApp 的一些 Apple 引用文档,但到目前为止我没有找到解决方案。

iOS版本有这个问题吗?我该如何解决这个问题?任何帮助表示赞赏。



Best Answer-推荐答案


您的 UIAuomation 设置 plist 将为每个应用程序单独创建,以防发生调整。

/private/var/mobile/Containers/Data/Application/XXXXXXXX-ACAB-4FC9-AE3E-XXXXXX/Library/Preferences/com.apple.UIAutomation.plist 中启用它>重新启动您的设备以消除此错误。

关于ios - 设置错误消息中未启用 UIAutomation,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34870587/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://sqlite.in/) Powered by Discuz! X3.4