title: How to use navigator.app.exitApp() to exit application in cordova on iOS platform?
body: <p>I have an application built using cordova but I don't know how to add exit/stop function to exit the application.After looking around in google and other sites I got clue to use <code>navigator.app.exitApp()</code> but it didn't work for me. How can I solve this?</p>
  
  <p>here is my code:</p>
  
  <pre><code>function onDeviceReady() {
              var network = navigator.connection.type;
  
              if (network === 'none') {
  
  
                      $cordovaDialogs.confirm('Attention' + '\n' + 'You have no internet connection', '', ['Review Settings', 'Exit'])
                          .then(function(buttonIndex) {
                              // no button = 0, 'OK' = 1, 'Cancel' = 2
                              var btnIndex = buttonIndex;
                              if (btnIndex == 1) {
                                  $state.go('register');
                              } else {
                                  navigator.device.exitApp();
                              }
                          });
  </code></pre>