iOS LocationManager is not updating location (Titanium Appcelerator module)

有些话、适合烂在心里 提交于 2019-12-31 05:45:12

问题


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:


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



来源:https://stackoverflow.com/questions/9648948/ios-locationmanager-is-not-updating-location-titanium-appcelerator-module

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!