PhoneGap应用程序在安装在设备上时可以访问localhost吗? [英] can a PhoneGap app access localhost upon being installed on device?

查看:141
本文介绍了PhoneGap应用程序在安装在设备上时可以访问localhost吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用PhoneJS开发了一个测试移动应用程序,它访问节点服务器(localhost:3000)w MongoDB本地数据库...
在Web浏览器或使用Ripple模拟器测试时,一切正常。

I developed a test mobile app with PhoneJS, which access a node server ( localhost:3000) w MongoDB local DB... Everything is working fine when testing in web browser or using Ripple simulator.

然后我使用PhoneGap / Cordova(3.0.0)部署了这个测试应用程序,并将其安装在我的iPhone设备上。
启动应用程序,数据没有加载(获得加载图标...,没有发生任何事情)
由于我的节点服务器在控制台中不显示任何内容,我想在.get Ajax call

Then I deployed this test app using PhoneGap/Cordova ( 3.0.0 ) and installed it on my iPhone device. Starting the app, the data are not loaded ( got the Loading icon... and nothing happen) As my node server doesn't display anything in the console, I guess there is an issue in the .get Ajax call

是否有任何特定的参数要添加到PhoneGap config.xml中?
(我已经:github.com/erwin/DataBound.Mobile.git包括..

is there any specific parameter to be added to the PhoneGap config.xml ? ( I have already : github.com/erwin/DataBound.Mobile.git included ..

推荐答案

这台电脑,所以当你尝试从您的手机访问localhost,你不会得到一个答案,因为你的手机没有服务器。

Localhost is "this computer" so when you try to access localhost from your phone you don't get an answer because you don't have a server in your phone.

如果服务器和电话在同一网络上,请使用localhost将计算机的本地IP用于服务器

You have to use the local IP of the computer with the server instead using localhost if the server and the phone are on the same network

这篇关于PhoneGap应用程序在安装在设备上时可以访问localhost吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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