0

I have an app that on first run asks if the user will permit notifications. It brings up the standard OS UI for this. I'm now doing CI with Xcode server and when I do installs to the server's Simulators, they get stuck on "Allow notifications"

Is there a way to trigger this automatically in the Bot script?

Note: Xcode 8.x, macOS Sierra.

More details can be added as needed.

Dru Freeman
  • 1,766
  • 3
  • 19
  • 41

1 Answers1

0

Have a look at the XCTestCase.addUIInterruptionMonitor(withDescription:handler:) API which can be used to provide a closure which will be invoked when an alert such as the Notification Permissions prompt appears.

https://developer.apple.com/reference/xctest/xctestcase/1496273-adduiinterruptionmonitor

Brian Croom
  • 325
  • 3
  • 5
  • 3
    No, this wouldn't work in a unit test. If the alert is interfering with your unit tests in some way, a workaround might be to have your bot run a scheme with first a UI test target and then your unit test target. The UI Test target could have a single test that triggers the alert and then dismisses it, to prep the device. – Brian Croom Dec 23 '16 at 04:07