gpt4 book ai didi

iOS UI 测试 : Handle all system prompt automatically with addUIInterruptionMonitorWithDescription

转载 作者:可可西里 更新时间:2023-11-01 05:33:06 36 4
gpt4 key购买 nike

这两本我都看完了。

Xcode7 | Xcode UI Tests | How to handle location service alert?

Xcode 7 UI Testing: Dismiss Push and Location alerts

我可以知道以下内容吗?

1) 对于位置,放置“位置对话框”表示它将处理位置提示。它是如何识别的?

2) 如何处理系统提示访问相册或相机?是否有处理程序描述的列表?

最佳答案

这里是 addUIInterruptionMonitorWithDescription 的 xcode 文档。

/*! Adds a handler to the current context. Returns a token that can be used to unregister the handler. Handlers are invoked in the reverse order in which they are added until one of the handlers returns true, indicating that it has handled the alert.
@param handlerDescription Explanation of the behavior and purpose of this handler, mainly used for debugging and analysis.
@param handler Handler block for asynchronous UI such as alerts and other dialogs. Handlers should return true if they handled the UI, false if they did not. The handler is passed an XCUIElement representing the top level UI element for the alert.
*/
public func addUIInterruptionMonitorWithDescription(handlerDescription: String, handler: (XCUIElement) -> Bool) -> NSObjectProtocol

1) “位置对话框”只是一个处理程序描述,供您识别您处理的警报。你可以写点别的。

2) 你必须使用相同的方法。之后只需点击该应用程序。

这里我使用这部分代码来处理推送通知:

addUIInterruptionMonitorWithDescription("Push notifications") { (alert) -> Bool in
if alert.buttons["OK"].exists {
alert.buttons["OK"].tap()
return true
}
return false
}
app.tap()

干杯

关于iOS UI 测试 : Handle all system prompt automatically with addUIInterruptionMonitorWithDescription,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36672836/

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