Hi Graham IIRC, mobileSensorReading() returns an array so you need to check the keys of the array.
Perhaps: if tSensorData["latitude"] is empty then .... HTH cheers Alan > On Mon, 13 Apr 2020 14:38:56,Graham Samuel <[email protected] > <mailto:[email protected]>> 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 > _______________________________________________ use-livecode mailing list [email protected] Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
