Phonegap - Open Navigation Directions in Apple Maps App

后端 未结 4 1445
走了就别回头了
走了就别回头了 2020-12-15 09:06

I have two variables - Destination and Source - and, using Phonegap, I\'m trying to use jQuery to open the external iPhone Apple Maps app with directions.

The code I

4条回答
  •  南笙
    南笙 (楼主)
    2020-12-15 09:49

    In my case, changing from http://maps.apple.com/?q= to only maps:?q= not solving the problem.

    The working scheme that open native Apple Maps with marker is as follows:

    maps://maps.apple.com/?q={latitude},{longitude}
    

    full working code:

    window.location.href = "maps://maps.apple.com/?q="+lat+","+lng;
    

    Tested working with iOS7.1 simulator, might not works in later version. I don't have the opportunity to test. Sorry.

    Supported Apple Maps parameters can be found here: https://developer.apple.com/library/ios/featuredarticles/iPhoneURLScheme_Reference/MapLinks/MapLinks.html

    Credit goes to this SO link: Here

提交回复
热议问题