here the xcode-documentation of addUIInterruptionMonitorWithDescription
.
/*! 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) "Location Dialog" is just a handlerDescription for you to identifie what alert you handle. You can write somethings else.
2) You have to use the same method. Just tap the app after.
Here i use this part of code to handle Push notifications:
addUIInterruptionMonitorWithDescription("Push notifications") { (alert) -> Bool in
if alert.buttons["OK"].exists {
alert.buttons["OK"].tap()
return true
}
return false
}
app.tap()
Cheers