Xcode-Instruments无法使用我选择的应用目标在模拟器上运行应用 [英] Xcode-Instruments cannot run app on simulator with the app target I choose

查看:341
本文介绍了Xcode-Instruments无法使用我选择的应用目标在模拟器上运行应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用带有仪器的UIAutomation在iOS应用上运行自动化.

I am trying to run an automation on an iOS App using UIAutomation with Instruments.

几周后我尝试了一下,效果很好.但是,与此同时,我尝试了另一个自动化测试框架(Square的KIF),现在当我尝试使用Instruments运行Automation时,它拒绝工作.

It had worked well when I had tried it out a few weeks back. However, I tried out another automation testing framework (KIF from Square) in the meantime, and now when I try and run Automation with Instruments, it refuses to work.

工作成功后,我执行了以下步骤:

When it had worked, I had carried out the following steps:

  1. 在Xcode中打开我的应用
  2. 运行应用
  3. 退出iOS模拟器
  4. 打开工具"(不一定通过Xcode,而只是通过在Spotlight中搜索工具"),选择自动化"
  5. 仪器会打开,当我单击选择目标"时,不需要浏览目标.我可以在列表中看到我的应用程序的名称(描述:应用程序名称不带.app扩展名,并且在名称之前有一个图标,例如出现在Xcode输出窗口顶部的图标-黑白图标带有渐变),即使我之前没有打开过它(即即使我是第一次打开乐器也是如此).
  6. 我从列表中选择此目标,选择要运行自动化的javascript文件,然后单击记录".自动化曾经运行,我可以看到它在用来打开的模拟器中运行.

但是,打开工具"不再在目标列表中向我显示目标.

However, opening Instruments no longer shows me the target in the list of targets anymore.

我尝试从文件系统(从派生数据"文件夹)以及从"iPhone模拟器"应用程序文件夹中选择目标;但没有运气.该目标不会像以前那样出现(在上面的描述中),而是以.app扩展名和典型的应用程序图标出现.自动化程序确实会启动并打开模拟器,但会显示以下消息:(尽管页面或脚本根本没有更改)

I have tried choosing a target from my filesystem (from the Derived Data folder) as well as from the iPhone Simulator applications folder; but no luck. The target does not appear as it used to before (in the description above), but appears with a .app extension and with the typical application icon. The automation does start and open up the simulator, but gives the following message: (although the page or the script haven't changed at all)

无法对无效元素执行操作:target.frontMostApp().mainWindow().elements()[2]中的UIAElementNil

Cannot perform action on invalid element: UIAElementNil from target.frontMostApp().mainWindow().elements()[2]

(本来希望发布图片,但不能,因为我是新用户,并且还没有所需的权限-希望描述可以弥补这一点)

(Would have liked to post images, but can't, since I am a new user and do not have the required permissions yet - hope the description makes up for it)

在这个问题上已经困扰了很长时间,我们将不胜感激!非常感谢!

Have been stuck on this issue for long and any help would be appreciated! Thanks so much!

推荐答案

我刚刚使用Xcode中的Product-> Profile对应用程序进行了配置,并使用目标打开了Instruments.目标是派生数据-> MyApp-> Build Products-> Release-iphonesimulator-> MyApp.app-> MyApp unix可执行文件下的Unix可执行文件.

I just profiled the app using Product -> Profile in Xcode, and that opened up Instruments with the target. The target was the Unix executable under Derived Data -> MyApp -> Build Products -> Release-iphonesimulator -> MyApp.app -> MyApp unix executable.

此外,在使用KIF时,我为情节提要中的某些视图启用了辅助功能标签.在Instruments中运行自动化测试时,该应用似乎以某种方式考虑了将可访问性标签设置为一个元素且无法访问该视图上子元素的视图.为了与Instruments一起运行,我只是禁用了视图的可访问性标签,并且再次发挥了作用!

Also, while using KIF, I had enabled accessibility labels for some views in the storyboard. While running the automation tests in Instruments, the app seemed to somehow consider the views which had the accessibility labels set as one single element and could not access sub-elements on this view. In order to run with Instruments, I just disabled the accessibility labels for the views and it worked like a charm again!

这篇关于Xcode-Instruments无法使用我选择的应用目标在模拟器上运行应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆