Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>So, to use a unique CLLocateManager, you can create a class to be the delegate for all you maps., so, instead of doing:</p> <pre><code>self.locationManager = [[CLLocationManager alloc] init]; _locationManager.delegate = self;</code></pre> <p>Do something like:</p> <pre><code>self.locationManager = [[CLLocationManager alloc] init]; _locationManager.delegate = mySharedDelegate;</code></pre> <p>Where mySharedDelegate is your class with all the CLLocationManager delegate methods.</p> <p>You can only get a valid coordinate for the userLocation, after the first calling of <pre><code>- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation</code></pre></p> <p>When this method is called it is because the GPS has found the new location and so the blue dot will be moved to there and the userLocation will have the new coordinate.</p> <p>Use the following method on your CLLocationManager delegate to log the current location when it is found:</p> <pre><code>- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { NSLog(@"---------- locationManager didUpdateToLocation"); location=newLocation.coordinate; NSLog(@"Location after calibration, user location (%f, %f)", _mapView.userLocation.coordinate.latitude, _mapView.userLocation.coordinate.longitude); }</code></pre> <p>Have you got the idea?</p> <p>Cheers,<br /> VFN</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload