Post Reply 
Free42 - LOCAT won't work on iPhone
05-05-2017, 09:47 PM
Post: #1
Free42 - LOCAT won't work on iPhone
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
Find all posts by this user
Quote this message in a reply
05-05-2017, 11:39 PM
Post: #2
RE: Free42 - LOCAT won't work on iPhone
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*
Visit this user's website Find all posts by this user
Quote this message in a reply
05-06-2017, 12:23 AM (This post was last modified: 05-06-2017 12:26 AM by Gerson W. Barbosa.)
Post: #3
RE: Free42 - LOCAT won't work on iPhone
(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.
Find all posts by this user
Quote this message in a reply
05-06-2017, 01:02 AM (This post was last modified: 05-06-2017 02:16 AM by Paul Dale.)
Post: #4
RE: Free42 - LOCAT won't work on iPhone
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"]
Find all posts by this user
Quote this message in a reply
05-06-2017, 01:35 AM
Post: #5
RE: Free42 - LOCAT won't work on iPhone
(05-06-2017 01:02 AM)Paul Dale Wrote:  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 the zero, I got coordinates that seem plausible.


Pauli

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.)
Visit this user's website Find all posts by this user
Quote this message in a reply
05-06-2017, 02:18 AM
Post: #6
RE: Free42 - LOCAT won't work on iPhone
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
Find all posts by this user
Quote this message in a reply
05-06-2017, 03:23 AM (This post was last modified: 05-06-2017 03:27 AM by Gerson W. Barbosa.)
Post: #7
RE: Free42 - LOCAT won't work on iPhone
-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.
Find all posts by this user
Quote this message in a reply
05-06-2017, 06:52 AM (This post was last modified: 05-06-2017 06:52 AM by Massimo Gnerucci.)
Post: #8
RE: Free42 - LOCAT won't work on iPhone
Working here (Android) on second call: 45,4302338...

Greetings,
    Massimo

-+×÷ ↔ left is right and right is wrong
Visit this user's website Find all posts by this user
Quote this message in a reply
05-06-2017, 11:00 AM (This post was last modified: 05-06-2017 12:42 PM by Thomas Okken.)
Post: #9
RE: Free42 - LOCAT won't work on iPhone
(05-06-2017 03:23 AM)Gerson W. Barbosa Wrote:  -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.

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.
Visit this user's website Find all posts by this user
Quote this message in a reply
05-06-2017, 01:10 PM
Post: #10
RE: Free42 - LOCAT won't work on iPhone
(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.

Wikis are great, Contribute :)
Find all posts by this user
Quote this message in a reply
05-06-2017, 01:44 PM
Post: #11
RE: Free42 - LOCAT won't work on iPhone
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 on
In 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 -9
Done 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
Find all posts by this user
Quote this message in a reply
05-06-2017, 01:56 PM (This post was last modified: 05-06-2017 02:00 PM by Gerson W. Barbosa.)
Post: #12
RE: Free42 - LOCAT won't work on iPhone
(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 :-)

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.

Ah, OK, I thought 25°25'25"S was some random incorrect result, but since you're in Curitiba, it's actually entirely plausible. :-)

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:

[Image: 34355530621_9093e776b6_b.jpg]

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 :-)

[Image: 34444853646_b4d6f4f868_b.jpg]
Find all posts by this user
Quote this message in a reply
05-06-2017, 03:13 PM
Post: #13
RE: Free42 - LOCAT won't work on iPhone
(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)

Greetings,
    Massimo

-+×÷ ↔ left is right and right is wrong
Visit this user's website Find all posts by this user
Quote this message in a reply
05-06-2017, 03:57 PM
Post: #14
RE: Free42 - LOCAT won't work on iPhone
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
Find all posts by this user
Quote this message in a reply
05-06-2017, 06:41 PM
Post: #15
RE: Free42 - LOCAT won't work on iPhone
(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.
Find all posts by this user
Quote this message in a reply
05-06-2017, 06:49 PM
Post: #16
RE: Free42 - LOCAT won't work on iPhone
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
Find all posts by this user
Quote this message in a reply
05-06-2017, 07:05 PM (This post was last modified: 06-11-2017 07:24 AM by Thomas Okken.)
Post: #17
RE: Free42 - LOCAT won't work on iPhone
(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.

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.

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.
Visit this user's website Find all posts by this user
Quote this message in a reply
05-06-2017, 10:50 PM
Post: #18
RE: Free42 - LOCAT won't work on iPhone
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
Find all posts by this user
Quote this message in a reply
05-07-2017, 02:59 PM
Post: #19
RE: Free42 - LOCAT won't work on iPhone
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?
Visit this user's website Find all posts by this user
Quote this message in a reply
05-14-2017, 05:37 PM
Post: #20
RE: Free42 - LOCAT won't work on iPhone
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.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 2 Guest(s)