iPhone 无法识别 PhoneGap 的 navigator.app [英] iPhone does not recognize PhoneGap's navigator.app

查看:35
本文介绍了iPhone 无法识别 PhoneGap 的 navigator.app的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个退出应用程序的按钮.该函数如下所示:

I have a button to exit from the application. The function looks like this:

//Close application
function close_window() {
  navigator.app.exitApp();
}

它不起作用,所以我尝试了以下行:

It did not work, so I tried the following line:

navigator.device.exitApp();

也没有用.然后我通过警报发现 iPhone 无法识别 PhoneGap 的 navigator.app 和 navigator.device.我使用的是 PhoneGap 2.2.0 版.

It did not work either. Then I discovered by alert that the iPhone does not recognize PhoneGap's navigator.app and navigator.device. I use PhoneGap version 2.2.0.

为什么会这样?

P.S.:它适用于我在 Android 上.

P.S.: It works for me on Android.

推荐答案

navigator.app.exitApp() 不适用于 IOS,仅适用于 Android.在 iOS 上,Apple 不允许应用程序以编程方式退出.

navigator.app.exitApp() does not work on IOS, only Android. On iOS, Apple does not allow apps to programmatically exit.

可以通过 iOS 目标 c 端完成,但此应用很有可能在 Apple 应用商店中被拒绝.

It can be done through iOS objective c side but there's a good chance this app will be rejected in Apple app store.

在这里你会找到一个很好的解释:https://groups.google.com/forum/?fromgroups=#!topic/phonegap/XjTm0ua4uOY.

Here you will find a good explanation: https://groups.google.com/forum/?fromgroups=#!topic/phonegap/XjTm0ua4uOY.

这篇关于iPhone 无法识别 PhoneGap 的 navigator.app的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆