问题
I'm using UITest for testing an objective C app, using swift for the tests.
XCode 7.3, sim 9.3
Every test case invokes XCUIApplication.launch(), which kills any running application by sending SIGKILL.
Xcode treats this like a crash - invoking the debugger on main.m
. To proceed with the test suite I just click the continue button in the debugger.
After hitting continue, my log says:
Message from debugger: Terminated due to signal 9
This situation is frustrating because it happens after 1/4 of my test cases. Causing me to lose focus on the document I'm editing and causing my test suite to hang until I hit continue.
Is there a way around this?
回答1:
We experienced the same issue. After some debugging we found out this was caused by having Background Modes
enabled for your app.
Our solution was to make a new target for development and testing that has all Background Modes
disabled.
FYI, in the Capabilities
section of your project settings it's labeled as Background Modes
turning this Off
is key. Alternatively, you could remove the Require background modes
(aka UIBackgroundModes
) key from your Info.plist
回答2:
You can go for debugging and/or testing after termination using xCode. In the menu:
- Debug
- Attach to Process
- Choose from
Likely Targets
orBy Process Identifier (PID)
来源:https://stackoverflow.com/questions/36409060/possible-to-prevent-xcode-from-envoking-debugger-after-calling-xcuiapplication