MGLLocationManagerDelegate
@protocol MGLLocationManagerDelegate <NSObject>
The MGLLocationManagerDelegate
protocol defines a set of methods that respond
to location updates from an MGLLocationManager
object that is serving as the
location manager of an MGLMapView
.
-
Notifies the delegate with the new location data.
Declaration
Objective-C
- (void)locationManager:(nonnull id<MGLLocationManager>)manager didUpdateLocations:(nonnull NSArray<CLLocation *> *)locations;
Swift
func locationManager(_ manager: MGLLocationManager, didUpdate locations: [CLLocation])
Parameters
manager
The location manager reporting the update.
locations
An array of
CLLocation
objects in chronological order, with the last object representing the most recent location. This array contains multipleCLLocation
objects whenMGLMapView
uses its default location manager.
-
Notifies the delegate with the new heading data.
Declaration
Objective-C
- (void)locationManager:(nonnull id<MGLLocationManager>)manager didUpdateHeading:(nonnull CLHeading *)newHeading;
Swift
func locationManager(_ manager: MGLLocationManager, didUpdate newHeading: CLHeading)
Parameters
manager
The location manager reporting the update.
newHeading
The new heading update.
-
Asks the delegate if the calibration alert should be displayed.
Declaration
Objective-C
- (BOOL)locationManagerShouldDisplayHeadingCalibration: (nonnull id<MGLLocationManager>)manager;
Swift
func locationManagerShouldDisplayHeadingCalibration(_ manager: MGLLocationManager) -> Bool
Parameters
manager
The location manager reporting the calibration.
-
Notifies the delegate that the location manager was unable to retrieve location updates.
Declaration
Objective-C
- (void)locationManager:(nonnull id<MGLLocationManager>)manager didFailWithError:(nonnull NSError *)error;
Swift
func locationManager(_ manager: MGLLocationManager, didFailWithError error: Error)
Parameters
manager
The location manager reporting the error.
error
An error object containing the error code that indicates why the location manager failed.