错误:Phonegap 中的白名单拒绝 [英] Error: Whitelist rejection in Phonegap

查看:41
本文介绍了错误:Phonegap 中的白名单拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是移动开发的新手.我正在使用 Phonegap/Cordova 创建一个跨平台的应用程序.我的代码在 Android 上运行良好,但是当我将它移植到 iPhone 时,它​​显示了一个错误:

I'm new to mobile development. I'm using Phonegap/Cordova to create a cross-platform app. My code works well on Android but when I'm porting it to iPhone it's showing an error:

[143:2003] ERROR whitelist rejection: url="abc"

现在我能克服这个问题吗?

Now can I overcome this problem?

推荐答案

注意:此答案仅适用于 PhoneGap 1.x 及以下版本.从 2.x 版本开始,白名单配置通过 cordova.xml 完成.

Notice: This answer only applies for PhoneGap version 1.x and below. From version 2.x onwards, whitelist configuration is done via cordova.xml.

您必须将允许的 URL 添加到 PhoneGap.plist(或 Cordova.plist)的 ExternalHosts 数组中.

You have to add allowed URLs into PhoneGap.plist's (or Cordova.plist) ExternalHosts array.

例如,如果要允许访问此 URL http://www.myhost.com/path/file,则添加 www.myhost.com作为 ExternalHosts 数组的新条目.

For example, if you want to allow access to this URL http://www.myhost.com/path/file, then add www.myhost.com as a new entry to ExternalHosts array.

如果您想允许访问 Google 的所有子域(例如 maps.google.commails.google.com)上的内容,您可以添加 *.google.com 作为 ExternalHosts 数组的新条目.

If you want to allow access to content on all the subdomain of Google (e.g. maps.google.com, mails.google.com), you can add *.google.com as a new entry to ExternalHosts array.

不过,我不确定您为什么会在链接中显示abc".你有abc"作为任何东西的链接吗?是URI片段吗?

I am not sure why you get "abc" in the link, though. Do you have "abc" as a link to anything? Is it URI fragment?

这篇关于错误:Phonegap 中的白名单拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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