iOS LocationManager is not updating location (Tita

2020-05-08 18:14发布

I've made Appcelerator Titanium Module for fetching device's rotaion and location. Source can be found on GitHub.

The problem is that it fetches only one cached location but device motion data is OK and it is refreshing.

I don't use delegate, I pull that data in my Titanium Javascript Code. If I set "City Run" in Simulator -> Debug -> Location nothing happens. The same cached location is returning.

Pulling of location is OK because I tried with native app wich does this:

textView.text = [NSString stringWithFormat:@"%f %f\n%@",
                     locationManager.location.coordinate.longitude,
                     locationManager.location.coordinate.latitude,
                     textView.text];

And it is working in simulator and on device.

But the same code as you can see on GitHub is not working as Titanium module.

Any ideas?

EDIT:

I am looking at GeolocationModule src and I see nothing special there.

As I said, my code in my module has to work since it is working in native app. "Only" problem is that it is not updating location and it always returns me that cached location.

1条回答
ゆ 、 Hurt°
2楼-- · 2020-05-08 19:15

The answer is to put ENSURE_UI_THREAD at the top of function that starts location updating.

查看更多
登录 后发表回答