gpt4 book ai didi

xcode7 - 中断后等待 App 空闲

转载 作者:行者123 更新时间:2023-12-01 11:52:33 28 4
gpt4 key购买 nike

我有一个 ViewController,它将通过 init 请求访问位置服务

if ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusNotDetermined)
{
[_locationManager requestWhenInUseAuthorization];
}

这会触发“允许应用程序在您使用该应用程序时访问您的位置?”警报。

我使用 [self addUIInterruptionMonitorWithDescription:handler:] 对此使用react。我遇到以下问题:关闭请求对话框后,ui 测试不会继续。警报已解除,但 Xcode 等待应用程序变为空闲状态,但看起来应用程序空闲的:

t =    67.35s             Wait for app to idle

测试失败,因为应用卡在了这里。如果我进入模拟器,Xcode 会记录。

t =    72.27s         Synthesize event

然后继续测试。

有什么原因,为什么 Xcode 会尝试等待应用程序?解决方法似乎是告诉 Xcode UI 已更改或发生了事件。有没有办法触发它?

最佳答案

呈现警报后,您必须与界面进行交互。这是 Xcode 7.2 的一个已知错误。只需点击该应用程序即可正常工作,但这是必需的。

addUIInterruptionMonitorWithDescription("Location Dialog") { (alert) -> Bool in
alert.buttons["Allow"].tap()
return true
}

app.buttons["Find Games Nearby?"].tap()
app.tap() // need to interact with the app for the handler to fire
XCTAssert(app.staticTexts["Authorized"].exists)

参见 my blog post获取更多信息。

关于xcode7 - 中断后等待 App 空闲,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34587711/

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