Düzenle

Aracılığıyla paylaş


CoreLocation Namespace

The CoreLocation namespace provides classes for tracking and monitoring location, regions (including iBeacons), and geocoding.

Classes

CLAuthorizationChangedEventArgs

Provides data for the AuthorizationChanged event.

CLBeacon

Represents a local-area device that can be used for fine-grained location monitoring.

CLBeaconRegion

CoreLocation region determined by an iBeacon.

CLCircularRegion

A CLRegion defined by a center and a radius (in meters).

CLFloor

Information describing a building level.

CLGeocoder

Provides support for converting between an address in text form and a location described using latitude and longitude or to convert from a latitue and longitude to a user-friendly location (street, city, state, country).

CLHeading

Heading data as generated by the CLLocationManager.

CLHeadingUpdatedEventArgs

Provides data for the UpdatedHeading event.

CLLocation

Location information as generated byt he CLLocationManager class.

CLLocationDistance

A class whose static members define constants relating to filtering and maximum distance.

CLLocationManager

Manages the delivery of location, region, and heading events to your application.

CLLocationManagerDelegate

Virtual methods on this class receive notifications from the CLLocationManager.

CLLocationManagerDelegate_Extensions

Extension methods to the ICLLocationManagerDelegate interface to support all the methods from the CLLocationManagerDelegate protocol.

CLLocationsUpdatedEventArgs

Provides data for the LocationsUpdated event.

CLLocationUpdatedEventArgs

Provides data for the UpdatedLocation event.

CLPlacemark

Associates data such as street address with a coordinate.

CLRegion

The base class for trackable geographical regions.

CLRegionBeaconsFailedEventArgs

Provides data for the RangingBeaconsDidFailForRegion event.

CLRegionBeaconsRangedEventArgs

Provides data for the DidRangeBeacons event.

CLRegionErrorEventArgs

Provides data for the MonitoringFailed event.

CLRegionEventArgs

Provides data for the RegionLeft, E:CoreLocation.CLRegionEventArgs.RegionEntered and E:CoreLocation.CLRegionEventArgs.RegionLeft events.

CLRegionStateDeterminedEventArgs

Provides data for the DidDetermineState event.

CLVisit

Relates a location and radius with an arrival and departure time.

CLVisitedEventArgs

Provides data for the DidVisit event.

Structs

CLLocationCoordinate2D

Geographical coordinates.

Interfaces

ICLLocationManagerDelegate

Interface representing the required methods (if any) of the protocol CLLocationManagerDelegate.

Enums

CLActivityType

An enumeration whose values specify different types of activity.

CLAuthorizationStatus

An enumeration whose values specify the current status of authorization to use location services.

CLDeviceOrientation

An enumeration whose values represent the device's physical orientation.

CLError

Errors returned by the CLLocationManager.

CLProximity

An enumeration whose values specify the physical proximity of an iBeacon.

CLRegionState

An enumeration whose values specify whether the device is inside or outside a region or unknown.

Delegates

CLGeocodeCompletionHandler

A delegate that is the completionHandler in calls to GeocodePostalAddressAsync(CNPostalAddress, NSLocale).

CLLocationManagerEventArgs

Event arguments generated by the ShouldDisplayHeadingCalibration event.

Remarks

The Core Location namespace revolves around tracking and monitoring user location, the device's entry-and-exit from regions (either fixed or iBeacon-based), and geocoding between addresses and locations.

Geocoding use-cases center on the CLGeocoder class. Geocoding is simple:

async void GeocodeToConsoleAsync (string address) {
    var geoCoder = new CLGeocoder();
    var placemarks = await geoCoder.GeocodeAddressAsync(address);
    foreach (var placemark in placemarks) {
	      Console.WriteLine(placemark);
    }   

As is reverse-geocoding:

async void ReverseGeocodeToConsoleAsync (CLLocation location) {
    var geoCoder = new CLGeocoder();
    var placemarks = await geoCoder.ReverseGeocodeLocationAsync(location);
    foreach (var placemark in placemarks) {
	      Console.WriteLine(placemark);
    }          
}

Other use-cases typically will start with the CLLocationManager class:

  • Tracking the device's location:
  • Region monitoring (Geofencing):
  • iBeacon ranging:

These use-cases are discussed in the CLLocationManager class documentation.