简体   繁体   English

白名单不与人行横道一起工作

[英]whitelist not working ionic with crosswalk

I created a working app using ionic. 我创建了一个使用离子的工作应用。 there was no problem with fetching data from my site and everything was good. 从我的网站获取数据没有问题,一切都很好。

I then went to add crosswalk to it and now i get the error when i run it on my android phone: 然后我去添加人行横道,现在我在我的Android手机上运行时出现错误:

W/XWalkCordovaResourceClient():URL blocked by whitelist: http://example.com/api/

In the top level config.xml i have tried each of the following (not all 3 at once) and reran it (ionic run android) with the same results: 在顶级config.xml中,我尝试了下面的每一个(并非所有3个一次)并重新使用它(离子运行android)具有相同的结果:

  <access origin="*"/>
  <access origin="http://www.example.com/*"/>
  <access origin="http://www.example.com"/>

What am I doing wrong? 我究竟做错了什么?

running 'ionic info' i get: 运行'离子信息'我得到:

OS: Max OS Yosemite
Nodoe Version: v0.10.36
Cordova CLI: 4.3.0
Ionic CLI Version: 1.3.19
Xcode version: Xcode 6.2 Build Version 6C121e
ios-sim version: 3.1.1.

As a separate but possible related question, after installing crosswalk running the app on an android emulator has stopped working also - after building successfully it just says 'the app has stopped' 作为一个单独但可能相关的问题,安装人行横道后运行Android模拟器上的应用程序也已停止工作 - 成功构建后它只是说“应用程序已停止”

I figured it out! 我想到了! The problem is that in the latest Cordova, they've split out the whitelist functionality into its own plugin. 问题是,在最新的Cordova中,他们将白名单功能分解为自己的插件。

Simply run ionic plugin add https://github.com/apache/cordova-plugin-whitelist.git and you're good! 只需运行ionic plugin add https://github.com/apache/cordova-plugin-whitelist.git就可以了!

I had problems getting tiles from openstreetmaps and google maps api and i solved it by followed the answer from this thread http://forum.ionicframework.com/t/crosswalk-whitelist/20329 . 我有问题从openstreetmaps和谷歌地图api获取瓷砖,我按照这个主题http://forum.ionicframework.com/t/crosswalk-whitelist/20329的答案解决了它。

Basically the workaround is to go to ""\\platforms\\android\\src\\org\\crosswalk\\engine\\XWalkCordovaResourceClient.java" line 204, comment the return out and rebuild the app. 基本上解决方法是转到“”\\ platforms \\ android \\ src \\ org \\ crosswalk \\ engine \\ XWalkCordovaResourceClient.java“第204行,注释退货并重建应用程序。

Its not a smooth solution but it solves my problem for now. 它不是一个顺利的解决方案,但它现在解决了我的问题。

In regards to your other question the steps i would suggest is to first : Emulate using Genymotion. 关于你的另一个问题,我建议的步骤首先是:使用Genymotion进行模拟。 If that doesnt work i would try to remove and re-add Android. 如果这不起作用,我会尝试删除并重新添加Android。

Hope it helps. 希望能帮助到你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM