You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

geolocation doesn't work with iOS 6 web apps!

The javascript geolocation service doesn't work with iOS 6 web apps. We have a web app that works fine in iOS 5 and it works fine in iOS 6 in Safari. But in iOS 6 if you create a web app by adding clicking on the middle icon at the bottom of Safari and adding the app to your home screen it doesn't work anymore. The geolocation call simply hangs.


I created a really simple test problem. Simply go to http://stroll.nextbus.com/webkit/test.jsp in Safari to try it out. Then create a Home Screen icon for it and click on the icon and you can see that your position is never displayed. You can look at the html to understand this trivial application.


So how does one contact Apple to get them to investigate this issue?


And by the way, we have already gotten a huge number of complaints about this problem!


-- Mike

iPhone 4S, iOS 6

Posted on Sep 19, 2012 8:50 PM

Reply
71 replies

Nov 14, 2012 1:10 PM in response to MikeAtNextBus

As a developer I can understand that there are bugs, but I can't believe this bug was not fixed along with 6.0.1. This is major issue for many web apps. Shame for Apple, especially now as they emphasis web based mapping solution as alternatives to their own native map app.


I filed a bug report but I guess 1000 more might make wheels rolling.


cheers,

matti

Nov 27, 2012 5:14 AM in response to MikeAtNextBus

Same issue here 😟 (which is a bummer for my project pocket-locator.com)


I did this script which use watchPosition and i have no problem on

- iPad iOS5 browser & standalone

- iPhone4 iOS5 browser & standalone

- Blackberry Torch OS7 browser

- Blackberry Curve OS7 browser

- Blackberry PlayBook OS2 browser

- Galaxy S2 OS4 browser

- Nokia Lumia 920 wp8 browser

- iPhone4 iOS6 browser

- Safari OSX

- Firefox OSX


The only issue comes from iOS6 standalone mode.

Test URL : http://www.hello-gurus.com/labs/geoloc.html

Dec 14, 2012 11:06 AM in response to travisdahl

travisdahl - I don't see the reference to latest beta in the link from your previous post


does anyone else have intel on this?


Apple: FWIW we are running a high profile environmental project that relies on this working properly - you can read about it here.


http://www.nytimes.com/2011/11/28/science/earth/nature-conservancy-partners-with -california-fishermen.html


This bug has killed our application - its a huge problem and has me trying to downgrade our existing iPads (almost impossible) and moving to Android based tablets


Matt Merrifield

GIO - The Nature Conservancy

Dec 22, 2012 12:01 AM in response to MikeAtNextBus

I have found a workaround for this. It turns out that you can implement the functionality of watchposition by repeatedly polling navigator.geolocation.getCurrentPosition. Set maximumAge to 0 so that you don't get a cached result. This should keep the GPS "hot".


In my implementation, function getLocation sets everything up (including saving a global callback function) and ends by calling getLocation0. Helper function getLocation0 has a single line that calls navigator.geolocation.getCurrentPosition, with getLocation1 as the immediate callback. This third function, getLocation1, checks to see if the accuracy is within the specified threshold or if we are past the specified timeout. If either of these conditions is true, we are done. Otherwise, we set a timeout that will go to getLocation0 after a specified time period, such as 500 ms.


This is simplified from code that is considerably more complex, and it is likely that I have broken it in the process, but hopefully you can get the general idea and adapt for your own use.


geolocate = (function () { // PRIVATE var lat, // Current latitude lon, // Current longitude acc, // Most recent accuracy reading callback, // Call this external function after updating location thresh, // accuracy threshhold for watchPosition, in meters giveUp; // Time at which to quit trying to get a more accurate geolocation reading // This function is called to report any geolocation errors we may get from our requests function displayError (error) { // Display error and cancel watch, if applicable alert ('Geolocation error [code=' + error.code + ', message="' + error.message + ']"'); }; // PUBLIC var geolocate = {}; geolocate.lat = function () { return lat; }; geolocate.lon = function () { return lon; }; geolocate.getLocation0 = function () { navigator.geolocation.getCurrentPosition( geolocate.getLocation1, displayError, {enableHighAccuracy:true, maximumAge:0} ); } geolocate.getLocation1 = function (position) { var now = new Date(); if (Math.round(position.coords.accuracy) <= thresh || now >= giveUp) { // display.message('Got it! Accuracy = ' + Math.round(position.coords.accuracy) + 'm'); lat = position.coords.latitude; lon = position.coords.longitude; acc = position.coords.accuracy; callback(); // Success! Now do whatever we were supposed to do next } else { setTimeout(geolocate.getLocation0, 500); timeLeft = Math.round((giveUp.getTime() - now.getTime()) / 1000), // display.message('Accuracy = ' + Math.round(position.coords.accuracy) + 'm; ' + timeLeft + 's left'); } } geolocate.getLocation = function (hook, accuracy, timeout) { if (navigator.geolocation) { // Process parameters and initialize variables callback = hook; giveUp = new Date(); giveUp.setTime(giveUp.getTime() + timeout*1000); // Give up after 'timeout' seconds geolocate.getLocation0(); } }; return geolocate; }() );


Example call:

geolocate.getAccurateLocation(myFunction, 50, 10);

geolocation doesn't work with iOS 6 web apps!

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.