Mr Speaker

iOS 4.3 Geolocation in web apps

Update: problem solved(ish)! See below...

Not again you Apple monsters! Last time it was multi touch that you decided to take from us, this time it's geolocation. Upgrading my iPhone 3GS to iOS4.3 caused a mobile web app I'm working on to start throwing errors. Danged if I can figure out why. Here's what I know so far...

Calling navigator.geolocation.getCurrentPosition in mobile safari works fine - returning a normal position object. However, when added to the home screen and run as fullscreen app (using the apple-mobile-web-app-capable meta tag) it would not ask for permission to access geo features, but immediately fail returning the error:

Permission error; The operation couldn't be completed. (kCLErrorDomain error 1.)

Looks like a permission error to my professional eye. But why? Dunno. I made this test app, called "Geoful". If you could have a go and report back I'd be most grateful.

Here's some reports so far. Seems to follow no logic, which makes for exciting bug hunting...

Device  Firmware  Browser  Fullscreen
   4      4.3      works     works
   4      4.3      failz     works
  3GS    4.2.0     works     works
  3GS    4.2.1     works     works
  3GS     4.3      works     failz
  3GS     4.3      failz     works
  3GS     4.3      works     failz
 iPad1    4.3      works     works

Update 1: If it failz for you in teh web browser, try turning on "location services" in preferences for Sarari.

Update 2: Ok, here's the deal: if it's failing for you, got to Preferences -> General -> Reset -> Reset Location Warnings.
The next time you run the app it will requests permission and works as expected.

Interestingly, if I now say "no" when asked for permission the error returned is not the same one as I was getting earlier:

Permission error; User denied Geolocation

A bit more helpful than the old message I think you'll agree! I'm also not sure exactly where my app got "disallowed" - but it seems like the update to 4.3 defaulted it to "no permission". Though I'm not going to rule out "stupid user error", so I won't put this in the bug category jussst yet.


  1. Hey,

    very interesting post! I’m currently running into the same problem. Have you found any solution to this? Resetting Location Warnings did not do the trick for me :(

    // Daniel

    Monday, December 5, 2011 at 9:59 am | Permalink
  2. Hi,

    I was running into the same problem, I have solved it by deleting a file (I don’t remember its name) in the /private/var/mobile/Library/WebKit folder (you need a jailbroken iPhone)
    Now the error is gone !


    Thursday, January 26, 2012 at 7:22 pm | Permalink
  3. Thanks! This demystified this error I was getting. I’m just starting to explore geolocation in html on my iphone, and apparently I had denied “safari” geolocation access wholesale and never missed it!

    For anyone squeamish about letting safari have wholesale geolocation access, know that safari will prompt you anew for each website that requests access, so no worries that some random website will suddenly know your location.

    Wednesday, June 13, 2012 at 11:44 am | Permalink
Captcha! Please type 'radical' here: *
How did you find this thingo? *