views:

927

answers:

3

Hi, I have a question.

I'm developing on an app that is location-based, I have a mapView set to show the user location (mapView.showUserLocation); I also have a locationUpdate function to retrive lat/long of current position:

(void)locationUpdate:(CLLocation *)location{} 

After I call the function stopUpdatingLocation to stop the update location, the mapview (blue ball) continues to update my location...

In other word: is there another locationUpdate funtion is called automatically from the mapview??

Thanks in advance.

+1  A: 

You have the showsUserLocation property of your MKMapView set (this property is editable in Interface Builder).

From its documentation:

Setting this property to YES causes the map view to use the Core Location framework to find the current location. As long as this property is YES, the map view continues to track the user’s location and update it periodically.

gerry3
A: 

I think you might use both MKMapView and CLLocationManager. (void)locationUpdate is executed when there's a position obtained by CLLocationManager. MKMapView uses GPS device independently and updates itself.

You should stop using showUserLocation and use CLLocationManager to obtain location, then MKMapView to present it.

Jacek
A: 

thank for your answer!...

since i need to use the reversegeocoder to show immediatly the locality on a label, i thik that i'm forced to create my own instance of CLocationManager because when try to start the reverse-geocoding in the viewDidLoad, like:

geoCod=[[MKReverseGeocoder alloc]initWithCoordinate:mapView.userLocation.coordinate]; geoCod.delegate=self; [geoCod start];

the label don't update the locality, but if i start the reverse-geocoding in my own instance of CLLocationManager the label update correclty...

any idea??!!

Mat