问题描述
使用在iOS 11上运行的Xcode 9运行我的XCUITests套件.
Running my suite of XCUITests using Xcode 9 running on iOS 11.
所有测试均在Xcode 8(iOS10)中完美运行,但是在Xcode 9中,我收到以下错误消息:
Tests all run perfect in Xcode 8 (iOS10), but in Xcode 9 I get the following error:
Main Thread Checker: UI API called on background thread [UIApplication statusBarOrientation]...
... Queue name: com.Flurry.Analytics.Session
可以通过注释掉所有Flurry代码来解决此问题,但这显然不理想.以前开发人员已经看到过此问题: https://github.com/flurry/flurry-ios-sdk/issues/91
This can be fixed by commenting out all the Flurry code, but that is obviously not ideal. This issue has been seen by devs previously:https://github.com/flurry/flurry-ios-sdk/issues/91
但是,在这种情况下,开发人员构建可以正确编译所有文件,并且仅当运行XCUITests时才会发生此错误.
However, in this case, the dev build compiles all correctly and this error only occurs when XCUITests are run.
有人知道如何解决这个问题吗?
Anyone know how to fix this?
推荐答案
为避免测试崩溃,您必须在方案中取消选中Main Thread Checker
To avoid crash in test you have to uncheck Main Thread Checker
in your Scheme
转到Product > Scheme > Manage Schemes
搜索用于测试的方案,然后按左侧栏中的Edit...
并按Test
,然后转到Diagnostics
并取消选中Main Thread Checker
复选框
Go Product > Scheme > Manage Schemes
search the Scheme you use for your tests and press Edit...
in the left sidebar press Test
and then go to Diagnostics
and uncheck Main Thread Checker
checkbox
然后重试
这是一个临时解决方案,您应尝试避免在后台线程上调用UI API,因为该应用程序的行为可能很怪异.但是,由于您使用的是第三方库,因此您应该等到他们修复它之后.
This is a temporal solution and you should try to avoid call UI API on background threads because the app could behave weirdly. But since you use third-party library you should wait until they fix it.
这篇关于Xcode 9,iOS 11,XCUITest失败:主线程检查器Flurry Analytics的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!