Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Geolocation not working in iPhone simulator

Hi. The app I was developing, which utilises geolocation, was working fine. I then upgraded to the latest version of Titanium (1.7.2) and now I cannot get geolocation working when testing on the app but it works fine if I install it on my iPhone - in addition, it doesn't work in the KitchenSink example now as well (says that GPS needs to be enabled in the settings). I'm building for version 4 of iPhone and to be clear, I didn't change my code - one day it was working, then I upgraded and the geolocation was disabled and unable to be used on the simulator.

I've tried deleting the project and rebuilding but it doesn't make a difference. Help please?

Cheers.

— asked August 31st 2011 by Andrew Mills
  • geolocation
  • iphone4
0 Comments

6 Answers

  • If you are running Xcode 4.1 and are using OSX Lion, this is a known issue for Apple. This is an issue for all devs using iOS native, Titanium, or otherwise.

    — answered August 31st 2011 by Matt Apperson
    permalink
    2 Comments
    • Ah. Yes I am. Does anybody have a suggestion of a possible work around for this?

      — commented August 31st 2011 by Andrew Mills
    • At the moment I recommend using an if statement checking if your using the simulator, and if so use a hardcoded location like so:

      if(Ti.Platform.model == 'iPhone Simulator') {
          // fake location
      } else {
          //get real location
      }
      

      — commented August 31st 2011 by Matt Apperson
  • Try resetting the simulator. Go to the menu bar to iOS Simulator, then reset Content and Settings.

    — answered August 31st 2011 by Kosso
    permalink
    0 Comments
  • Thanks for your suggestion but it made no difference (on KitchenSink I still get the message saying Geolocation is turned off and I should turn it on).

    — answered August 31st 2011 by Andrew Mills
    permalink
    0 Comments
  • Hi. Yes it is enabled but there is no apps listed underneath (and I thought apps that recently requested a location would appear here).

    — answered August 31st 2011 by Andrew Mills
    permalink
    3 Comments
    • you should add your responses to the answer, it makes it easier to follow the thread.

      Are you checking on your computer? not the simulator or device

      — commented August 31st 2011 by Aaron Saunders
    • Apologies. I checked my computer settings to confirm the location services were enabled (and the first suggestion to reset the simulator I did through the simulator menu).

      — commented August 31st 2011 by Andrew Mills
    • I've also just tried uninstalling and reinstalling Titanium Studio and the same thing happens. There is no error message, it just says that I need to enable the geolocation functionality - it always returns false when I use this method Ti.Geolocation.locationServicesEnabled.

      — commented August 31st 2011 by Andrew Mills
  • Just installed xcode 4.2 on Lion, problem is still not fixed.

    — answered October 14th 2011 by Ralf Klotzbuecher
    permalink
    4 Comments
    • Just checking here… Did you download from the mac app store? because if so you still need to install it. Also, it must be installed to the default install location, not as a second install. I am just checking as this catches a lot of people…

      — commented October 14th 2011 by Matt Apperson
    • oops. Good comment. 5.0 seems to work fine.

      Have to get used to this unusual installation procedure ….

      — commented October 14th 2011 by Ralf Klotzbuecher
    • Could you explain what the unusual installation procedure is?

      — commented October 17th 2011 by Andrew Mills
    • As Matt said, installing Xcode update from the app-Store does not install the update, it just downloads the installer app. You have to look for "install xcode.app" in your application directory an then run it manually.

      — commented October 17th 2011 by Ralf Klotzbuecher
  • check that you have not disabled Location Services in your Settings, Goto "Preferences -> Security" on your computer

    — answered August 31st 2011 by Aaron Saunders
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.