Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/121.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 如何在xcode中检查xctest用例中显示的警报视图_Ios_Iphone_Xcode_Unit Testing_Xctest - Fatal编程技术网

Ios 如何在xcode中检查xctest用例中显示的警报视图

Ios 如何在xcode中检查xctest用例中显示的警报视图,ios,iphone,xcode,unit-testing,xctest,Ios,Iphone,Xcode,Unit Testing,Xctest,我需要在屏幕上显示任何验证案例的警报,并且工作正常。但是当使用XCTest时,我无法检测是否显示警报。如何在XCTest中的UIAlertView或UIAlertController案例中检查Xcode。请给出任何建议您可以使用添加UIInterruptionMonitor在xTest中处理UIAlertController let handler = addUIInterruptionMonitor(withDescription: "alert handler") { (alert: XCU

我需要在屏幕上显示任何验证案例的警报,并且工作正常。但是当使用
XCTest
时,我无法检测是否显示警报。如何在
XCTest
中的
UIAlertView
UIAlertController
案例中检查
Xcode
。请给出任何建议

您可以使用
添加UIInterruptionMonitor
xTest
中处理
UIAlertController

let handler = addUIInterruptionMonitor(withDescription: "alert handler") { (alert: XCUIElement) -> Bool in
    let ok = alert.buttons["OK"]
    XCTAssertTrue(ok.exists, "OK button doesn't exist")
    ok.tap()
}

这对我不起作用。你能检查一下并确认一下吗。