YMKLocationManager

class YMKLocationManager : NSObject

Handles location updates and changes.

Summary

Instance methods

func subscribeForLocationUpdates(withDesiredAccuracy desiredAccuracy: Double,
                                                             minTime: Int64,
                                                         minDistance: Double,
                                                allowUseInBackground: Bool,
                                                       filteringMode: YMKLocationFilteringMode,
                                                    locationListener: YMKLocationDelegate)
Subscribe for location update events

func requestSingleUpdate(withLocationListener locationListener: YMKLocationDelegate)
Subscribe to a single location update

func unsubscribe(withLocationListener locationListener: YMKLocationDelegate)
Unsubscribe from location update events

func suspend()
Stops updates for all subscriptions until resume() is called

func resume()
Resumes updates stopped by a suspend() call

Instance methods

subscribeForLocationUpdates(withDesiredAccuracy:minTime:minDistance:allowUseInBackground:filteringMode:locationListener:)

func subscribeForLocationUpdates(withDesiredAccuracy desiredAccuracy: Double,
                                                             minTime: Int64,
                                                         minDistance: Double,
                                                allowUseInBackground: Bool,
                                                       filteringMode: YMKLocationFilteringMode,
                                                    locationListener: YMKLocationDelegate)

Subscribe for location update events. If the listener was already subscribed to updates from the LocationManager, subscription settings will be updated. Use desiredAccuracy = 0 to obtain best possible accuracy, minTime = 0 to ignore minTime and use minDistance instead, minDistance = 0 to use only minTime. If both minTime and minDistance are set to zero, the subscription will use the same settings as other LocationManager clients.

The class does not retain the object in the 'locationListener' parameter. It is your responsibility to maintain a strong reference to the target object while it is attached to a class.

Parameters

desiredAccuracy

Desired location accuracy, in meters. This value is used to configure location services provided by the host OS. If locations with the desired accuracy are not available, updates may be called with lower accuracy.

minTime

Minimal time interval between events, in milliseconds.

minDistance

Minimal distance between location updates, in meters.

allowUseInBackground

Defines whether the subscription can continue to fetch notifications when the application is inactive. If allowUseInBackground is true, set the location flag in UIBackgroundModes for your application.

filteringMode

Defines whether locations should be filtered.

locationListener

Location update listener.


requestSingleUpdate(withLocationListener:)

func requestSingleUpdate(withLocationListener locationListener: YMKLocationDelegate)

Subscribe to a single location update. If the listener was already subscribed to location updates, the previous subscription will be removed.

The class does not retain the object in the 'locationListener' parameter. It is your responsibility to maintain a strong reference to the target object while it is attached to a class.

Parameters

locationListener

Location update listener.


unsubscribe(withLocationListener:)

func unsubscribe(withLocationListener locationListener: YMKLocationDelegate)

Unsubscribe from location update events. Can be called for either YMKLocationManager::subscribeForLocationUpdatesWithDesiredAccuracy:minTime:minDistance:allowUseInBackground:filteringMode:locationListener: or YMKLocationManager::requestSingleUpdateWithLocationListener:. For YMKLocationManager::requestSingleUpdateWithLocationListener:, if an event was already received, YMKLocationManager::unsubscribeWithLocationListener: does not have any effect. If the listener is already unsubscribed, the method call is ignored.

The class does not retain the object in the 'locationListener' parameter. It is your responsibility to maintain a strong reference to the target object while it is attached to a class.

Parameters

locationListener

Listener passed to either YMKLocationManager::subscribeForLocationUpdatesWithDesiredAccuracy:minTime:minDistance:allowUseInBackground:filteringMode:locationListener: or YMKLocationManager::requestSingleUpdateWithLocationListener:.


suspend()

func suspend()

Stops updates for all subscriptions until resume() is called.


resume()

func resume()

Resumes updates stopped by a suspend() call.


Предыдущая
Следующая