Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-15761] iOS: Geolocation: Setting ACCURACY_BEST or ACCURACY_HIGH before adding eventlistener sets ACCURACY_THREE_KILOMETERS

GitHub Issuen/a
TypeBug
PriorityLow
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 3.2.0
Fix Version/sn/a
ComponentsiOS
LabelsSupportTeam
ReporterTiman Rebel
AssigneeUnknown
Created2013-11-04T11:51:41.000+0000
Updated2018-02-28T20:03:36.000+0000

Description

If you set the accuracy of Ti.Geolocation to ACCURACY_BEST or ACCURACY_HIGH before adding an eventlistener to Ti.Geolocation, the accuracy is actually set to ACCURACY_THREE_KILOMETERS. It is caused because ACCURACY_BEST and ACCURACY_HIGH have the value of -1 and there is a check for accuracy not being -1 (because in the past it could only be 0 or greater?) in GeolocationModule.m The workaround is to set ACCURACY_BEST or ACCURACY_HIGH again after adding an eventlistener, but it took us 3 weeks to find this. Either document this in the docs or change this behavior, but I can not believe this is intended. SDK: 3.2.0.v20131010124846 GeolocationModule.m - line 284:
-(CLLocationManager*)locationManager
{
	[lock lock];
	if (locationManager==nil)
	{
		RELEASE_TO_NIL(tempManager);
		locationManager = [[CLLocationManager alloc] init];
		locationManager.delegate = self;
		if (!trackSignificantLocationChange) {
            if (accuracy!=-1)
            {
                locationManager.desiredAccuracy = accuracy;
            }
            else
            {
                locationManager.desiredAccuracy = kCLLocationAccuracyThreeKilometers;
            }
            locationManager.distanceFilter = distance;
        }

Comments

No comments

JSON Source