gpt4 book ai didi

ios - 在新模拟器上运行时关闭 iOS 13 键盘教程

转载 作者:行者123 更新时间:2023-11-29 05:14:00 26 4
gpt4 key购买 nike

我使用 Xcode 11 和 iOS 13 作为 UITest 工作流程的一部分,但是当我第一次使用键盘时,会出现以下内容并通过阻止键盘来中断测试:

UI测试中调用代码:

app.textFields.element(boundBy: 0).tap()

模拟器显示的内容: enter image description here

由于这会阻碍按键,因此我的测试将失败。但是,下次我在同一个模拟器上运行测试时,它将正常工作。

最佳答案

CodeBender 的答案很好,并且引导了正确的路径,但无法编译,因为 continue 是 Swift 中的保留关键字。另外,等待键盘显示一段时间就好了。

    // Sometimes the Apple Keyboard shows some sort of "Swipe" tutorial. Dismiss it!
private func begoneSwipeTutorial(app: XCUIApplication) {
let continueButton = app.buttons["Continue"]
if continueButton.waitForExistence(timeout: 2.0) {
continueButton.tap()
}
}

// Then use like this
func inputTextWhatever(app: XCUIApplication, element: XCUIElement) {
element.tap()
begoneSwipeTutorial(app: app)
// Do whatever you need to do
}

关于ios - 在新模拟器上运行时关闭 iOS 13 键盘教程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59379891/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com