PhoneBap 2.2和ios 6(ipad)上的ChildBrowser无法正常工作

时间:2012-12-13 20:25:35

标签: cordova ios6 phonegap-plugins childbrowser

我正在尝试使用iOS 6上的phonegap 2.2和最新的xCode来运行ChildBrowser插件。我按照插件的github wiki / readme中的官方说明进行操作。似乎插件正在加载,但是当我打电话时

window.plugins.childBrowser.showWebPage('http://www.google.com',{showLocationBar:true});

没有任何反应!

有任何线索吗?想法?

谢谢!

3 个答案:

答案 0 :(得分:0)

如果您只是收到“正在加载...”消息,请确保您引用了Ios ChildBrowser插件附带的childbrowser.js,而不是其他平台(如Android)。如果你没有得到任何东西,请确保你有“ChildBrowser” - > Cordova.plist中的“ChildBrowserCommand”而不是“ChildBrowser” - > “ChildBrowser.js”。另外,确保你的设备就绪事件被解雇了,我曾经不小心将一个android项目中的cordova-2.2.0.js复制到了IOS,导致所有事件都被停止了。

答案 1 :(得分:0)

iOS 6的ChildBrowser插件存在一个突出问题。

您应该能够测试一下这是否特定于iOS6。在iOS5模拟器下运行您的应用程序。如果ChildBrowser有效,那么您就知道您遇到了iOS 6特定的问题。

支持问题已经打开,但我知道还没有解决方案......

https://github.com/phonegap/build/issues/55

答案 2 :(得分:0)

1)使用build.phonegap.com

2)在assets \ www文件夹

下添加以下config.xml
<?xml version="1.0" encoding="UTF-8" ?>
<widget xmlns = "http://www.w3.org/ns/widgets"
    xmlns:gap = "http://phonegap.com/ns/1.0"
    id        = "com.phonegap.example"
    version   = "1.0.0">

<name>PhoneGap Build Application</name>

<description>
A simple PhoneGap Build application.
</description>

<author href="https://example.com" email="you@example.com">
Your Name
</author>
    <preference name="orientation"     value="portrait" />
<feature name="http://plugins.phonegap.com/ChildBrowser/2.0.1" />
<access origin="*" />
</widget>

3)删除所有使用childbrowser功能的特定页面引用的phonegap2.x.x.js和childbrowser2.x.x.js(如index.html) 然后只需添加以下内容,即使它不在文件夹中(phonegap构建器将使用更新版本)

<script src="phonegap.js"></script>
<script src="childbrowser.js"></script> 

4)只需将以下内容用于测试

 <ul>
  <li><a href="#" onClick="window.plugins.childBrowser.showWebPage('http://www.xyz.com')">Click here to open</a></li>
 </ul>

希望最好:)