Frage

If CLLocationManager semi working in my app. I start the locationManager, set the delegate, and accuracy. But once the location manager starts my map shows me in some ocean?

Is there a way to know when CLLocationManager has a lock?

I have the following method setup, but it doesn't get called unless I walk a few steps.

-(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations

I have verified that its all running on the main thread.

War es hilfreich?

Lösung

Look at the horizontalAccuracy property of the CLLocation objects you receive in didUpdateLocations. On a device, when you first start location services, you'll often notice a series of locations coming in with decreasing horizontalAccuracy values (i.e. more and more accurate location values). It's not a question of when it "locks in", but rather when do you receive a location with a horizontalAccuracy that is sufficiently small for your app's purposes.

In terms of the method not getting called until you move, that is generally a function of what desiredAccuracy and distanceFilter values you use.

Andere Tipps

There is nothing like lock in CLLocationManager ,

It depends on properties that you have set for your location manager,

check these properties of your location manager

distanceFilter : The minimum distance (measured in meters) a device must move horizontally before an update event is generated.

desiredAccuracy : The accuracy of the location data.

You can check location service using class method locationServicesEnabled for checking whether location services are enabled on the device.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top