gpt4 book ai didi

ios - Swift UI 测试在 iphone4s 模拟器上失败,与其他模拟器配合良好

转载 作者:行者123 更新时间:2023-11-28 08:50:12 25 4
gpt4 key购买 nike

我的应用程序中有一个登录屏幕,然后在关闭登录 View 后出现一个标签栏。

应用程序本身在所有设备/模拟器中运行良好。 UI 测试适用于除 iphone 4s 以外的所有模拟器。

我认为原因是登录后,登录屏幕消失的时间太长了。因此,当我尝试访问标签栏时,它会抛出异常。

我试过了

let tabBarsQuery = app.tabBars
let predicate = NSPredicate(format: "exists == true")
expectationForPredicate(predicate, evaluatedWithObject: tabBarsQuery, handler: nil)
waitForExpectationsWithTimeout(15, handler: nil)

出现以下错误

failed: caught "NSUnknownKeyException", "[<XCUIElementQuery 0x7e080d40> valueForUndefinedKey:]: this class is not key value coding-compliant for the key exists."

为什么期望不起作用?我怎么解决这个问题?

最佳答案

所以这个问题似乎是,无论出于何种原因,XCUIElementQueries 的集合不存在 .exists 属性。在您的示例中,您不能执行 app.tabBars.exists。但是,您可以将谓词更改为:

let predicate = NSPredicate(format: "count > 0")

这应该有效。

关于ios - Swift UI 测试在 iphone4s 模拟器上失败,与其他模拟器配合良好,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34440972/

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