Xcode UITesting 崩溃 [英] Xcode UITesting crashes

查看:33
本文介绍了Xcode UITesting 崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在生成 UI 测试时,有人熟悉以下问题吗?

Anyone familiar with the following issue when generating UI tests?

Crashed Thread:        26  Dispatch queue: XCUIRecorder_iOS.processingQueue

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

问题在于尝试按下控件时,Xcode 突然崩溃.

The problem lies in the fact that when trying to press a control, Xcode suddenly crashes.

我知道这是一个广为人知的错误,但是,到目前为止有什么解决方案吗?

I know this is a widely known error, however, any solutions so far?

谢谢!

推荐答案

我遇到了同样的问题,我设法找到了解决此问题的方法.

I had the same problem and I managed to find a workaround for this problem.

在我的例子中,我有一个包含大量单元格的集合视图,我试图测试与单元格的交互,一旦我点击单元格,Xcode 就会崩溃并出现相同的错误.我查看了崩溃日志,然后

In my case I had a collection view with lots of cells in it, I was trying to test the interaction with the cells and as soon as I was tapping a cell Xcode will crash with the same error. I've looked into the crash logs and after this

异常类型:EXC_CRASH (SIGABRT)异常代码:0x0000000000000000, 0x0000000000000000异常说明:EXC_CORPSE_NOTIFY

我能够找到视图树的 snapshopArray,就我而言,它看起来像这样:

I was able to find a snapshopArray of the view tree, in my case it was looking like this:

"Application 0x7fb0d39ce270: {{0.0, 0.0}, {320.0, 568.0}}, label: 'Workout'",
"Window 0x7fb0d643cda0: Main Window, {{0.0, 0.0}, {320.0, 568.0}}",
"Other 0x7fb0d58d9850: {{0.0, 0.0}, {320.0, 568.0}}",
"Other 0x7fb0d40c27f0: {{0.0, 0.0}, {320.0, 568.0}}",
"Other 0x7fb13a249920: {{0.0, 0.0}, {320.0, 568.0}}",
"Other 0x7fb138762330: {{0.0, 0.0}, {320.0, 568.0}}",
"Other 0x7fb0d5e1b830: {{0.0, 20.0}, {320.0, 497.0}}",
"CollectionView 0x7fb0d401ddd0: {{0.0, 64.0}, {320.0, 453.0}}",
"Cell 0x7fb13a6419e0: {{52.5, 96.0}, {43.0, 43.0}}, label: '2'",
"Other 0x7fb138701770: {{52.5, 96.0}, {43.0, 43.0}}",
"StaticText 0x7fb0d393d500: {{52.5, 96.0}, {43.0, 43.0}}, label: '2'"

不用太注意,可以看到CollectionView对象没有accessibilityLabel.我立即打开我的故事板,猜猜是什么,我没有为我的收藏视图启用辅助功能.我启用了它并添加了一个标识符和一个标签.再次运行 UI 测试记录并猜猜看:宾果游戏!没有更多的崩溃!

You dont need to pay too much attention and you can see that the CollectionView object doesnt have an accessibilityLabel. I immediately opened my storyboard and guess what, I didnt had Accessibility enabled for my collection view. I enabled it and added an identifier and a label. Run the UI Test recording again and guess what: BINGO! no more crashes!

您的情况可能有所不同,但请务必检查您的视图是否启用了可访问性,并且当然是否设置了标签和标识符.

Your case might be different but always check if your views have the accessibility enabled and have of course a label and an identifier set in place.

这篇关于Xcode UITesting 崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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