问题
I am testing a UIViewController in Xcode with an XCTest. In order to test some navigation and alert functionality I need to put my view controller in a UIWindow. I do so with the following code:
let myViewController = UIViewController()
let window = UIWindow(frame: UIScreen.main.bounds)
window.rootViewController = myViewController
window.makeKeyAndVisible()
However when makeKeyAndVisible()
is called my test fails with the following error:
2018-01-04 10:56:31.068462-0500 xctest[7858:315680] *** Assertion failure in -[BKSEventFocusManager deferEventsForClientWithProperties:toClientWithProperties:withPriority:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/BackBoardServicesFramework_Sim/backboarddaemon-193/BackBoardServices/BKSEventFocusManager.m:168 :0: error: -[MyTests.MyViewControllerTests testDoneTapped_dismissesViewController] : failed: caught "NSInternalInconsistencyException", "props must have a valid clientID"
Can anyone provide a solution or tell me what
"props must have a valid clientID"
means?
来源:https://stackoverflow.com/questions/48099154/uiwindow-makekeyandvisible-throws-props-must-have-a-valid-clientid-error-in