2017-04-26 116 views
0

我正在使用Angular/Javascript/Ionic打開本機Apple Maps並導航到我設置的地址,但我無法使其工作。它現在的作用是打開本地地圖,就是這樣。我需要手動點擊Apple Maps中的「導航」,才能真正開始導航。如何通過應用程序立即啓動導航?

我想要什麼?我希望它立即導航。所以,我想是這樣的:

enter image description here

我現在所擁有的,是這樣的:

enter image description here

這是我的代碼:

$scope.openNavigator = function() { 
    var geoString = ''; 

    if(ionic.Platform.isIOS()) { 
      url = 'http://maps.apple.com/maps?q=' + encodeURIComponent(address); 
    } 

    window.open(geoString, '_system'); 
} 

我怎麼能更新我的代碼段來做到這一點?有什麼我需要做的,以獲得直接的導航工作?

回答

0

當你給源和目的地輸入導航將工作:

http://maps.apple.com/?saddr=Cupertino&daddr=San+Francisco 

例如

url = 'http://maps.apple.com/maps?saddr='+sourceAddr+'&daddr='+destAddr; 
相關問題