Free42 - LOCAT won't work on iPhone - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: Not HP Calculators (/forum-7.html) +--- Forum: Not quite HP Calculators - but related (/forum-8.html) +--- Thread: Free42 - LOCAT won't work on iPhone (/thread-8303.html) Pages: 1 2 |
Free42 - LOCAT won't work on iPhone - Gerson W. Barbosa - 05-05-2017 09:47 PM Actually it worked only the first time I tried, then no more. Tested on two devices (iOS 10.3.1 and iOS 7.1.2). Gerson. 25°25'25" S RE: Free42 - LOCAT won't work on iPhone - Thomas Okken - 05-05-2017 11:39 PM Under Settings -> Privacy -> Location Services, are Location Services turned on, and under Settings -> Privacy -> Location Services -> Free42, is Allow Location Access set to While Using the App? LOCAT is working fine in Free42 2.0.2 on my iPhone 5S running iOS 10.3.1, and nothing has changed in the LOCAT code, nor in the permissions settings, since 1.5.6 (which addressed a new permissions policy in iOS 8, back in December 2014). Also, when LOCAT isn't working, you should be getting 0°N 0°E, not 25°25'25"S -- or is that your signature? Is the GPS working in Compass? *scratching head* RE: Free42 - LOCAT won't work on iPhone - Gerson W. Barbosa - 05-06-2017 12:23 AM (05-05-2017 11:39 PM)Thomas Okken Wrote: Under Settings -> Privacy -> Location Services, are Location Services turned on, and under Settings -> Privacy -> Location Services -> Free42, is Allow Location Access set to While Using the App? Yes. (05-05-2017 11:39 PM)Thomas Okken Wrote: Also, when LOCAT isn't working, you should be getting 0°N 0°E, not 25°25'25"S -- or is that your signature? Yes, I do get z: 0 y: 0 x: 0 25°25'25"S, that is, its decimal equivalent is what I got on both devices (a 7 and a 4), but only once. Next I started getting only zeroes. (05-05-2017 11:39 PM)Thomas Okken Wrote: Is the GPS working in Compass? Yes, the Compass gives me 25°25'25" S also, plus longitude and headings. (05-05-2017 11:39 PM)Thomas Okken Wrote: *scratching head* Please don't. Perhaps this is to some setting peculiarity. Let's wait for another example. Thank you! Gerson. RE: Free42 - LOCAT won't work on iPhone - Paul Dale - 05-06-2017 01:02 AM It is working fine here on my iPod. I got zero the first time I ran LOCAT (it prompted me to allow access to the location data) but after the initial zero, I got coordinates that seem plausible. Pauli [edit: fix sentence "but the zero"] RE: Free42 - LOCAT won't work on iPhone - Thomas Okken - 05-06-2017 01:35 AM (05-06-2017 01:02 AM)Paul Dale Wrote: It is working fine here on my iPod. LOCAT starts the Location service, if it isn't running already, and then returns whatever is the latest set of coordinates provided by that service. The location service provides coordinates through a callback, whenever it has any new ones, and Free42 stores the coordinates provided by that callback in a few global variables; LOCAT simply returns whatever happens to be in those globals. So, it's normal for LOCAT to return 0ºN 0ºE when first called, and for the first few seconds after that first call. Once the GPS gets a reasonable fix, LOCAT will start returning reasonable numbers. You can tell whether there is a reasonable fix by looking at the accuracy returned by LOCAT -- see http://thomasokken.com/free42/extensions.html -- if it is -1, ignore the result. N.B. I considered making LOCAT wait for a real fix before returning a result, but depending on the device and satellite visibility, that can take a long time, so I made it work in this asynchronous manner instead. (LOCAT behavior in the Android version is exactly the same.) RE: Free42 - LOCAT won't work on iPhone - Paul Dale - 05-06-2017 02:18 AM Thanks for the explanation. I figured the GPS hadn't obtained a fix. The first fix can be very slow for a number of reasons. Pauli RE: Free42 - LOCAT won't work on iPhone - Gerson W. Barbosa - 05-06-2017 03:23 AM -25,42373137231778 :-) I deleted Free42 from the older device and installed it again. It works fine now. After saving all my programs I'll do the same on the other device. Thanks again! Gerson. RE: Free42 - LOCAT won't work on iPhone - Massimo Gnerucci - 05-06-2017 06:52 AM Working here (Android) on second call: 45,4302338... RE: Free42 - LOCAT won't work on iPhone - Thomas Okken - 05-06-2017 11:00 AM (05-06-2017 03:23 AM)Gerson W. Barbosa Wrote: -25,42373137231778 :-) Ah, OK, I thought 25°25'25"S was some random incorrect result, but since you're in Curitiba, it's actually entirely plausible. :-) EDIT: To return to the original question: something obviously got into a bad state. It's good to know that uninstalling and reinstalling Free42 fixed it, but two other options also tend to fix "bad state" problems: (1) force-quitting the affected app, by double-pressing the home button, then swiping the app upwards; this performs a kill -9, which is as drastic as it gets except for (2) rebooting the device. RE: Free42 - LOCAT won't work on iPhone - pier4r - 05-06-2017 01:10 PM (05-06-2017 11:00 AM)Thomas Okken Wrote: force-quitting the affected app, by double-pressing the home button, then swiping the app upwards; this performs a kill -9, which is as drastic as it gets except for (2) rebooting the device. I did not know that swiping away an app is equal to kill -9 in the underlying system. Today I learned. Thanks for sharing. RE: Free42 - LOCAT won't work on iPhone - Sylvain Cote - 05-06-2017 01:44 PM Hello Thomas, I have been following this thread and trying solutions posted unfortunately it is still not working. Is it possible that the French Canadian setting on my iPhoneSE running iOS 10.3.1 has an affect of Free42 ? Best regards, Sylvain (05-05-2017 11:39 PM)Thomas Okken Wrote: Under Settings -> Privacy -> Location Services, are Location Services turned onIn my case its "Réglages" -> "Confidentialité" -> "Service de localisation", anyway it was already on. (05-05-2017 11:39 PM)Thomas Okken Wrote: under Settings -> Privacy -> Location Services -> Free42, is Allow Location Access set to While Using the App?"Réglages" -> "Confidentialité" -> "Service de localisation" -> but no Free42 here, the application is not present in the list (05-06-2017 03:23 AM)Gerson W. Barbosa Wrote: I deleted Free42 from the older device and installed it again.I also did that, but on the same device, no change. (05-06-2017 11:00 AM)Thomas Okken Wrote: (1) force-quitting the affected app, by double-pressing the home button, then swiping the app upwards; this performs a kill -9Done it, no avail ... (05-06-2017 11:00 AM)Thomas Okken Wrote: , which is as drastic as it gets except for (2) rebooting the device.I seem to repeat myself, not working RE: Free42 - LOCAT won't work on iPhone - Gerson W. Barbosa - 05-06-2017 01:56 PM (05-06-2017 11:00 AM)Thomas Okken Wrote: To return to the original question: something obviously got into a bad state. It's good to know that uninstalling and reinstalling Free42 fixed it, but two other options also tend to fix "bad state" problems: (1) force-quitting the affected app, by double-pressing the home button, then swiping the app upwards; this performs a kill -9, which is as drastic as it gets except for (2) rebooting the device. I had tried both options. BTW, option (1) is the way I always close Free42 on iOS, as shift OFF will only cause a beep, even after rebooting and installing. On my old kindle Fire shift OFF causes Free42 to exit, as expected. (05-06-2017 11:00 AM)Thomas Okken Wrote:(05-06-2017 03:23 AM)Gerson W. Barbosa Wrote: -25,42373137231778 :-) A quick calculation told me about 6 meters to the north would return 25°25'25.25" S, however here I am limited to only 2 meters more. 25°25'25.25252525... should be actually 10 meters northwards, judging from my outdoors readings. But I can never be sure as I got 25°25'25.26 and 25°25'25.27 and sometimes I would get as high as 25°25'25.40 here: Likewise, Massimo's latitude is less than 4 km southwards from the Duomo di Milano, which is quite plausible. Paul Dale's coordinates should be plausible too, except perhaps in this parallel Earth :-) RE: Free42 - LOCAT won't work on iPhone - Massimo Gnerucci - 05-06-2017 03:13 PM (05-06-2017 01:56 PM)Gerson W. Barbosa Wrote: Likewise, Massimo's latitude is less than 4 km southwards from the Duomo di Milano, which is quite plausible. That's actually (from Google Maps) 3,60 km (2,23 mi) RE: Free42 - LOCAT won't work on iPhone - John Smitherman - 05-06-2017 03:57 PM Sometimes clearing RAM on an i device helps resolve unexpected behavior: o Press the Sleep/Wake button. o Release the Sleep/Wake button when Slide to Power off appears. o Press the Home button. John RE: Free42 - LOCAT won't work on iPhone - Gerson W. Barbosa - 05-06-2017 06:41 PM (05-06-2017 03:23 AM)Gerson W. Barbosa Wrote: I deleted Free42 from the older device and installed it again. It works fine now. After saving all my programs I'll do the same on the other device. Just done it on the other device. It worked fine until I invoked LOCAT from a program. After reinstalling it, ok again. RE: Free42 - LOCAT won't work on iPhone - Sylvain Cote - 05-06-2017 06:49 PM Solved. I had to XEQ "LOCAT" once for the software to ask me the permission to use localization. After that, Free42 entry is available in "Réglages" -> "Confidentialité" -> "Service de localisation" and LOCAT works. 8-) Sylvain RE: Free42 - LOCAT won't work on iPhone - Thomas Okken - 05-06-2017 07:05 PM (05-06-2017 01:56 PM)Gerson W. Barbosa Wrote:(05-06-2017 11:00 AM)Thomas Okken Wrote: To return to the original question: something obviously got into a bad state. It's good to know that uninstalling and reinstalling Free42 fixed it, but two other options also tend to fix "bad state" problems: (1) force-quitting the affected app, by double-pressing the home button, then swiping the app upwards; this performs a kill -9, which is as drastic as it gets except for (2) rebooting the device. There's an explanation of why OFF behaves the way it does on iOS, and instructions on how to restore the old behavior, in the Free42 FAQ: http://thomasokken.com/free42/faq.html It sounds like the LOCAT problem is a bug, and I have an idea how it might be triggered, and how it might be fixed. I'll look into it. RE: Free42 - LOCAT won't work on iPhone - Paul Dale - 05-06-2017 10:50 PM Quote:A quick calculation told me about 6 meters to the north would return 25°25'25.25" S, however here I am limited to only 2 meters more. 25°25'25.25252525... should be actually 10 meters northwards, judging from my outdoors readings. But I can never be sure as I got 25°25'25.26 and 25°25'25.27 and sometimes I would get as high as 25°25'25.40 here You could wander around and wait. GPS coordinates drift over time and a 6m change is possible just from this. Of course, you're using more digits than the NMEA output from the GPS is supplying, so they'll be a degree of blockiness in the result. Pauli RE: Free42 - LOCAT won't work on iPhone - Thomas Okken - 05-07-2017 02:59 PM Here's what I found so far: when Free42 gets into this bad state, the GPS is still working (as indicated by the little arrow in the status bar), and the system log indicates that it is trying to deliver location updates, but somehow the callback that receives these updates is never called. There is an interesting error message in the system log, "Location callback block not executed in a timely manner!". Searching for this message, unfortunately, yields no results, neither on Google nor on the Apple Developer Forums, so apparently I have found a way to screw this up that is so stupid that literally no one else has this problem. :-) I did notice a couple of things: the bad state appears to be triggered when the location service is started, i.e. LOCAT is called while the arrow is *not* in the location bar, when LOCAT is called from a program. Call it from the FCN or CUSTOM menu and it's fine. Also, you can get out of the bad state by killing Free42, waiting for the arrow to go away, and then restarting Free42 (and calling LOCAT *not* from a program). The bad state only depends on the context of the *first* LOCAT call, apparently; once things are running in a good state, they stay that way even if you call LOCAT from a program, and when they're in a bad state, they stay that way even if you call LOCAT from the keyboard. Am I on the right track? Does this match what others are seeing? RE: Free42 - LOCAT won't work on iPhone - Thomas Okken - 05-14-2017 05:37 PM It turns out that initializing the location manager on a background thread causes the callbacks not to work -- and when you execute functions from the keyboard, they run on the main thread, and when they are executed from a program, they run on a background thread. I moved the LOCAT initialization to a separate method, which is now invoked using performSelectorOnMainThread, and that fixed the problem. This fix will be in the next release, 2.0.3. There is some other stuff that I also want to put in 2.0.3, so it will probably take a few more weeks before it is ready. |