【发布时间】:2019-10-12 16:31:46
【问题描述】:
我正在使用 Unity 3D 开发 VR 应用程序。它使用open weather map API 来访问一个城市的当前天气。该代码在 Windows 机器上运行时在 Unity 中运行良好。但开发成安卓应用安装到手机后,却无法获取天气信息。
IEnumerator GetWeather()
{
WWW request = new WWW("http://api.openweathermap.org/data/2.5/weather?q="+location+"&APPID=e3a642cec13d52496490dfa8e9ba11d3");
// WWW request = new WWW("http://api.openweathermap.org/data/2.5/weather?q=Anuradhapura,Sri Lanka&APPID=e3a642cec13d52496490dfa8e9ba11d3");
yield return request;
if (request.error == null)
{
Processjson(request.text);
}
else
{
Debug.Log(request.error);
}
}
谁能告诉我如何通过手机获取https://openweathermap.org/提供的天气信息?提前致谢。
【问题讨论】:
-
您能说出您在移动构建中遇到了什么错误吗?您是否尝试在这些行之间设置调试语句以查看您的代码在移动设备上的中断位置?
-
我没有收到任何错误。这不仅仅是工作。移动应用程序一次运行所有天气组件,无需访问打开的天气地图中的天气信息。
标签: android unity3d virtual-reality openweathermap