calabash/calabash-ios-server — pull request #69 by jmoody (2014-09-18 19:47:12+00:00)
Title: Gracefully exit the app

We initially thought that `calabash_exit` was causing Briar (and others) to crash iOS 8 devices. [1]

Karl did some testing on the XTC and found that `calabash_exit` was nearly doubling the runtimes.

Ultimately, I discovered the problem was not in `calabash_exit`. Along the way, I struck upon this nice strategy to exit the app gracefully.

What is nice about this solution is that the UIApplicationDelegate's `applicationWillResignActive:` and `applicationWillTerminate:` selectors are both called before the app is terminated.

```
saturn Briar-cal[340] : Received http exit.
saturn Briar-cal[340] : Calling [[UIApplication delegate] applicationWillResignActive] after a delay of 0.4 s
saturn Briar-cal[340] : application will resign active
saturn Briar-cal[340] : Calling [UIApplication willTerminate].
saturn Briar-cal[340] : Calling [UIApplication terminateWithSuccess] after a delay of 0.4 s
saturn Briar-cal[340] : application will terminate
saturn SpringBoard[48] : Unable to get short BSD proc info for 340: No such process
saturn SpringBoard[48] : Application 'UIKitApplication:com.littlejoysoftware.Briar-cal[0x1993]' exited voluntarily.
```