科尔多瓦3.4.0 InAppBrowser无法正常工作 [英] Cordova 3.4.0 InAppBrowser Not Working

查看:79
本文介绍了科尔多瓦3.4.0 InAppBrowser无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Cordova和JS的新手,并且一直在努力使Cordova 3.4.0的InAppBrowser插件在iOS(Xcode v5.0.2)中工作.

I'm new to Cordova and JS and have been struggling with the InAppBrowser plug-in for Cordova 3.4.0 to work in iOS (Xcode v5.0.2).

使用以下命令行命令成功构建了cordova项目:

The cordova project was built successfully using these command line commands:

cordova create InAppBrowserTest3-4 local.test InAppBrowser_Test3-4
cordova plugin add org.apache.cordova.inappbrowser
cordova platform add ios
cordova plugins
[ 'org.apache.cordova.inappbrowser' ]

www配置文件包含:

www config file contains:

<feature name="InAppBrowser">
    <param name="ios-package" value="CDVInAppBrowser" />
</feature>

仅将这些附加命令添加到生成的onDeviceReady方法中,以执行InAppBrowser:

Only these additional commands were added to the generated onDeviceReady method to exercise the InAppBrowser:

onDeviceReady:function(){ app.receivedEvent('deviceready');

onDeviceReady: function() { app.receivedEvent('deviceready');

//added these lines below
    alert('deviceReady');
    var ref = window.open('http://apache.org', '_blank', 'location=yes');
    ref.addEventListener('loadstart', function(event) { alert('start: ' + event.url); });
    ref.addEventListener('loadstop', function(event) { alert('stop: ' + event.url); });
    ref.addEventListener('loaderror', function(event) { alert('error: ' + event.message); });
    ref.addEventListener('exit', function(event) { alert(event.type); });
    alert('end deviceReady');
}

执行后,不会调用最后一个警报,并且没有打开浏览器.使用Cordova 2.9.0可以成功运行类似的代码.

When executed, the last alert isn't called and no browser is open. Similar code is running successfully using Cordova 2.9.0.

有人有什么建议吗?我已经阅读了几篇类似的文章,但尚未找到解决方案.

Does anyone have any suggestions? I've read through several similar posts but haven't found a solution yet.

推荐答案

要解决此问题,请尝试以下操作:

To solve this, try the following:

cordova create hello com.example.hello HelloWorld

cd hello

cordova platform add android

cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser.git

cordova build

请注意"cordova构建"步骤,该步骤将创建platform/ios/www目录,您可以在其中找到文件cordova_plugins.js并正确安装了文件夹插件.

Note the "cordova build" step, which creates the platform/ios/www directory where you can find the file cordova_plugins.js with the folder plugins correctly installed.

这篇关于科尔多瓦3.4.0 InAppBrowser无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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