1.CoreLocation Framework Usage Prerequisites:
#import <CoreLocation/CoreLocation.h>
The prefix for all data types in the Corelocation framework is CL, and the Cllocationmanager object is used in corelocation for user positioning
Common operations for 2.CLLocationManager:
Start user positioning-(void) startupdatinglocation;
Stop user positioning-(void) stopupdatinglocation;
When the Startupdatinglocation method is called, the user's location is started constantly, and the agent's method is called frequently in the middle
-(void) Locationmanager: (Cllocationmanager *) Manager didupdatelocations: (Nsarray *) locations;
The locations parameter contains the Cllocation object.
3.
Cllocation the geographic information used to represent a location, such as latitude and longitude, altitude, etc.
@property (readonly, nonatomic) Cllocationcoordinate2d coordinate; Warp latitude
@property (readonly, nonatomic) cllocationdistance altitude; Elevation
@property (readonly, nonatomic) Cllocationdirection course; Course, course (value range is 0.0°~ 359.9°,0.0° represents true north direction)
@property (readonly, nonatomic) cllocationspeed speed; Travel speed (unit m/s)
Using-(Cllocationdistance) Distancefromlocation: (const cllocation *) Location method calculates the distance between 2 locations
@property (Assign, nonatomic) cllocationdistance distancefilter; How many meters to locate each time
@property (Assign, nonatomic) cllocationaccuracy desiredaccuracy; Positioning accuracy (the more accurate it consumes)
Cllocationcoordinate2d is a structure used to represent latitude and longitude, defined as follows
typedef struct {cllocationdegrees latitude;//latitude cllocationdegrees longitude;//longitude} cllocationcoordinate2d;
The Cllocationcoordinate2dmake function is generally used to create cllocationcoordinate2d
4.
If it is an emulator, you need to set the analog location (latitude and longitude) the latitude and longitude of the celestial kingdom are: Latitude 40°, longitude 116 °
5.
GeoCode and GeoCode geocoding can be done using Clgeocoder: Obtain specific location information (such as latitude and longitude, full name of address, etc.) based on a given place name
Anti-geocoding: Based on the given latitude and longitude, get the specific location information Geocoding method
-(void) geocodeaddressstring: (NSString *) addressstring Completionhandler: (Clgeocodecompletionhandler) Completionhandler;
Anti-geocoding methods
-(void) Reversegeocodelocation: (cllocation *) location Completionhandler: (Clgeocodecompletionhandler) Completionhandler;
When geography \ anti-geocoding is complete, clgeocodecompletionhandler typedef void (^clgeocodecompletionhandler) is called (Nsarray *placemarks, Nserror *ERROR);
This block passes 2 parameter error: When the coding error (such as the code does not have specific information) has the value Placemarks: Inside contains the Clplacemark object
Clplacemark literally means a landmark, encapsulating detailed address location information
@property (nonatomic, readonly) cllocation *location; Location
@property (nonatomic, readonly) clregion *region; Regional
@property (nonatomic, readonly) nsdictionary *addressdictionary; Detailed address information
@property (nonatomic, readonly) NSString *name; Address name
@property (nonatomic, readonly) NSString *locality; City
Corelocation Framework geo-positioning in iOS