Problem simulating a location

Graham Samuel livfoss at
Mon Apr 13 08:38:56 EDT 2020

I’m trying to use the 10.2 XCode simulator to test an iOS app that uses the phone’s ability to know its location (usually via GPS). I can run the simulation and show that it’s working in a general way. Furthermore, mobileSensorAvailable("location”) responds in the simulated app, saying the sensor is ‘authorizedWhenInUse’

However the following button handler - adapted from a lesson by Devin Asay (very sincere thanks for all that, Devin!) always returns an empty result. I have set the location in the simulator to a (genuine) custom location, but if I choose one of the built-in locations, I still get the same result.

  On mouseUp
    mobileStartTrackingSensor "location” -- enable the sensor first
    put "now trying to get a one-off location reading" & return after fld “TheReport"
    put mobileSensorReading("location",false) into tSensorData -- this returns a string with the current latitude, longitude and altitude
    mobileStopTrackingSensor “location” -- turn off the sensor when done
    if tSensorData is empty then
        put "no location info!!" & return after fld "TheReport"
        put tSensorData & return after fld "TheReport"
   end if
 end mouseUp

Of course it’s me, but what am I doing wrong?


More information about the use-livecode mailing list