iOS   发布时间:2022-05-04  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了iOS UITesting:使用addUIInterruptionMonitorWithDescription自动处理所有系统提示大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

我已经读完了这两个. Xcode7 | Xcode UI Tests | How to handle LOCATIOn service alert? Xcode 7 UI TesTing: Dismiss Push and LOCATIOn alerts 我能知道以下情况吗? 1)对于位置,放置“位置对话框”表示它将处理位置提示.它如何识别? 2)如何处理访问图库或相机的系统提示?是否有任何处理程
我已经读完了这两个.

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

Xcode 7 UI Testing: Dismiss Push and Location alerts

我能知道以下情况吗?

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

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

解决方法@H_874_32@
这里是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 UITesting:使用addUIInterruptionMonitorWithDescription自动处理所有系统提示全部内容,希望文章能够帮你解决iOS UITesting:使用addUIInterruptionMonitorWithDescription自动处理所有系统提示所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。