尝试将我的 PhoneGap javascript 代码移植到 Xcode 中以便在 iOS 中进行调试。
使用 Cordova-3.0.0。
当我打电话时:
navigator.connection.type
我收到 navigator.connection 的“未定义”。
我是否没有在 config.xml 中正确包含网络连接插件,或者是否有其他问题?是的,我包含了专门针对 iOS 的正确的 cordova.js 文件。是的,deviceready 已被解雇。
更新:我目前只在 iOS 模拟器上运行它。
我的配置.xml:
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.app.test" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Hello Cordova</name>
<description>
Description
</description>
<author email="[email protected]" href="http://cordova.io">
Apache Cordova Team
</author>
<access origin="*" />
<preference name="fullscreen" value="true" />
<preference name="webviewbounce" value="true" />
<plugins>
<plugin name="NetworkStatus" value="CDVConnection" />
</plugins>
</widget>
感谢您的帮助!
我一直在研究这个问题,最后想出了解决方案。
显然 PhoneGap (Adobe) 最近更新了他们的文档,并填补了我在 Phonegap 3.0.0 中遇到的许多漏洞
1) 要使用命令行界面执行此操作,您必须安装 git 才能运行这些命令。得到git here.
2)他们添加到联系插件文档使用以下命令行界面命令将插件添加到项目中:
$ cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-network-information.git
$ cordova plugin rm org.apache.cordova.core.network-information
3) 他们将 config.xml 文件中的声明更新为以下内容(对于 iOS):
<feature name="NetworkStatus">
<param name="ios-package" value="CDVConnection" />
</feature>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)