1

我是新來的sencha觸摸,但我得到的錯誤似乎與谷歌地圖api有關。我正在打電話給谷歌地圖API來搜索sencha touch中的特定地點。但我得到以下錯誤谷歌地圖使用sencha觸摸有問題

enter image description here

這裏是我的店裏/ Places.js內部代碼文件

Ext.define('TestIOS.store.Places', { 
extend: 'Ext.data.Store', 
config: { 
    model: 'TestIOS.model.Place', 
    autoLoad: true, 

    proxy: { 
     type: 'ajax', 
     url: 'https://maps.googleapis.com/maps/api/place/search/json?location=-33.8670522,151.1957362&radius=500&types=food&name=harbour&sensor=false&key=AIzaSyCFWZSKDslql5GZR0OJlVcgoQJP1UKgZ5U', 
     reader: { 
      type: 'json', 
      rootProperty: 'results' 
     } 
    } 
} 
}); 

我該如何解決這個問題?

回答

1

正是由於Same Origin Policy 所以從我們不得不使用JSONP 其他服務器獲取數據,但似乎Google Maps API (v3) does not support jsonp的最新版本。因此,如果要進行地址解析,你將需要使用地圖API:將煎茶微加載之前

包括

<script src="http://maps.google.com/maps/api/js?sensor=false"></script> 
index.html中

<script id="microloader" type="text/javascript" src="sdk/microloader/development.js"></script> 

和得到任何地址使用谷歌地理編碼器 EX:

var geocoder = new google.maps.Geocoder(); 
    geocoder.geocode({'address': name of location }, 
     function(results, status) { console.log(results[0].geometry.location); });