Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Current Location doesn't work with Apple Maps IOS 6

Before IOS 6, I was using this URL scheme to open the native maps app and find directions from the users current location to an address that I created.

http://maps.google.com/maps?daddr=" + address + "&saddr=Current+Location

This was working great, but now that they got rid google maps with IOS 6, we had to check which IOS version they were on and then refer them to the new apple maps url scheme if they were using IOS 6.0 or greater. The new url scheme we are using is this....

http://maps.apple.com/maps?daddr=" + address + "&saddr=Current+Location

This is based on the new documentation for map url schemes, which can be found here..

Anyways, I've tested it a bunch and it boils down to the new apple maps does recognize Current Location, like google maps did.

Does anyone know how I fix this?

Keep in mind I am building a html app with phone gap, so using native code to set the starting address to current location won't help me.

like image 753
Ben Doherty Avatar asked Sep 21 '12 22:09

Ben Doherty


People also ask

Why is my current location not working?

Make sure Location Services is turned on To do that, go to the "Privacy" tab or your phone's settings, and select "Location Services." If it's turned on, scroll down, tap "Google Maps," and select either "While Using the App" or "Always."

Why is my Maps not finding my location?

It's possible the location accuracy option is disabled, you're using an older version of the app, or you don't have proper access to the internet. The Google Maps app itself may have issues, too. Cache files and other app data can sometimes cause various issues with the app.

How do I enable location on IOS?

You can turn Location Services on or off at Settings > Privacy > Location Services. You can turn Location Services on either during the Setup Assistant process or later through the Location Services setting. You can individually control which apps and system services have access to Location Services data.


2 Answers

I am having the same problem. I haven't found a solution yet but if you leave off the saddr

http://maps.apple.com/maps?daddr=" + address

it will just ask them where to start and the first option is "Current Location" so when they click "Current Location" it will show the map correctly.

If anyone finds a better solution please post it as I am still looking for a better solution.

like image 96
Tony Brix Avatar answered Sep 17 '22 12:09

Tony Brix


You can use my method:

    <script type="text/javascript">

        var link = "maps:saddr=YPlat,YPlong&daddr=42.118599,-72.625122";
        navigator.geolocation.getCurrentPosition(showPosition);

        function showPosition(position)
        {

            link = link.replace("YPlat",position.coords.latitude);
            link = link.replace("YPlong",position.coords.longitude);

            window.location = link;
        } 
    </script>

confirmed with iOS 5.1 and iOS 6

like image 33
dod_basim Avatar answered Sep 21 '22 12:09

dod_basim