Xcode 9, iOS 11, XCUITest failure: Main Thread Che

2019-05-23 08:36发布

Running my suite of XCUITests using Xcode 9 running on iOS 11.

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

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

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?

1条回答
何必那么认真
2楼-- · 2019-05-23 09:08

To avoid crash in test you have to uncheck Main Thread Checker in your Scheme

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

And try again

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.

查看更多
登录 后发表回答