Problem simulating a location
Graham Samuel
livfoss at mac.com
Tue Apr 14 11:18:07 EDT 2020
Folks, I am still struggling with this. Alan Stenhouse has been kind enough to help me, but so far I have not got the simulator to simulate any kind of location information.
There is a function, mobileCurrentLocation, that is supposed to return an array provided tracking is enabled and mobileSensorAvailable(“location”) has been invoked (see the LC Dictionary). I have made sure that both these things have been done, but In my tests on the simulator the array appears to be empty.
I suppose I can try the test on a real phone, but I would rather stick to the simulator for now. And I haven’t found out how LC knows I’ve got a provisioning profile (separate problem I admit).
Has anyone got any idea what’s going wrong?
Puzzled.
Graham
> On 13 Apr 2020, at 14:38, Graham Samuel <livfoss at mac.com> wrote:
>
> 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"
> else
> put tSensorData & return after fld "TheReport"
> end if
> end mouseUp
>
>
> Of course it’s me, but what am I doing wrong?
>
> Graham
More information about the use-livecode
mailing list