Ios PhoneGap和主干Ajax调用需要很长时间

Ios PhoneGap和主干Ajax调用需要很长时间,ios,ajax,backbone.js,cordova,Ios,Ajax,Backbone.js,Cordova,我有一个内置于主干网的phonegap应用程序,ajax调用花费了非常长的时间。加载46kb json文件的时间大约为2分钟或更长 我正在使用ios模拟器ping我的本地node.js服务器。node.js服务器向天气服务发出https.get()请求并返回该请求。当我在bowser中转到url时,调用工作得非常快 问题是否与移动内存管理或下划线模板有关?帮助我!谢谢 //视图/weather.js template: _.template($('#hero-1').html()), rend

我有一个内置于主干网的phonegap应用程序,ajax调用花费了非常长的时间。加载46kb json文件的时间大约为2分钟或更长

我正在使用ios模拟器ping我的本地node.js服务器。node.js服务器向天气服务发出https.get()请求并返回该请求。当我在bowser中转到url时,调用工作得非常快

问题是否与移动内存管理或下划线模板有关?帮助我!谢谢

//视图/weather.js

template: _.template($('#hero-1').html()),

render: function() {
    var view = this;
    $(this.el).html(this.template(view.model.toJSON()));
},

getWeatherData: function(lat, long){
      view.weatherModel = new this.model();
      view.weatherModel.fetch({
      data: {
        longitude: lat,
        latitude: long
      },
      success: function(data) {
          view.dataReturned(data.attributes);
          view.render();
      }
    });
 },
return Backbone.Model.extend({

    url: 'http://127.0.0.1:3000/weather',       

    parse: function(response){
        console.log("Parsing Response", response);
        response.weather.currently.avgTemp = Math.round(response.weather.currently.temperature);
        return response;
    }

});
//models/weather.js

template: _.template($('#hero-1').html()),

render: function() {
    var view = this;
    $(this.el).html(this.template(view.model.toJSON()));
},

getWeatherData: function(lat, long){
      view.weatherModel = new this.model();
      view.weatherModel.fetch({
      data: {
        longitude: lat,
        latitude: long
      },
      success: function(data) {
          view.dataReturned(data.attributes);
          view.render();
      }
    });
 },
return Backbone.Model.extend({

    url: 'http://127.0.0.1:3000/weather',       

    parse: function(response){
        console.log("Parsing Response", response);
        response.weather.currently.avgTemp = Math.round(response.weather.currently.temperature);
        return response;
    }

});
//html/Template

<script type="text/template" id="hero-1">
   <div id="weather-temp" class="weather-temp">
      <%= weather.currently.avgTemp %>
   </div>
</script>

它只是很快超时,但是如果我在模拟器的safari控制台中执行它,它就会工作

我没有意识到XCODE会重置ios模拟器的位置

打开模拟器:

窗口>调试>位置>自定义位置

设置一个新位置