Cannot run test using XCUITest driver. Original error: Could not connect to a valid app after 20 tries

IOS 10.0 simulator
appium 1.6.2

available_contexts method is failing

gist here:

here is an annoying screenshot i keep getting:

@jlipps @imurchie how do i fix this incoming connection pop up, somehow it seems every test run it is building this webdriveragentrunner app. Don’t understand why it needs to be build every test run or more than once?

I am also facing the same problem. I have the below component versions:
Mac OSX: Mac Sierra (10.12.2)
XCode: 8.2.1
Appium: 1.6.3
iOS Simulator: 10.0

Any suggestions as how to resolve this issue?

One observation I had about this pop-up dialogue is: even though we do not take any action the test keeps progressing. Yes, it is annoying to see the pop-up but it seems like it does not affect the test.