在iOS4.0之前点击iPhone上的主页按钮退出应用程序,Apple在他们的指南中没有接受以编程方式退出应用程序.
现在iOS4.0中的所有内容都发生了变化,单击主页按钮会使您的应用程序处于挂起模式(多任务处理)..我认为应该有一个明确的方式让用户退出应用程序,如退出按钮.
苹果现在好吗?怎么做呢?
我有一个使用cordova 构建的应用程序,但我不知道如何添加退出/停止功能来退出应用程序。在谷歌和其他网站上环顾四周后,我得到了使用的线索,navigator.app.exitApp()但它对我不起作用。我该如何解决这个问题?
这是我的代码:
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();
}
});
Run Code Online (Sandbox Code Playgroud) 我有一个基于标签的应用程序,其最后一个标签按钮是"退出"我怎么能相当iPhone应用程序,点击最后一个标签栏?