Two main frameworks
Map Kit for maps
Core Foundation for Geo-positioning
LBS Location based service (targeting-based services)
SoLoMo Social Local Mobile
1.CLLocationManager
Common operations and properties of Cllocationmanager
Start user positioning-(void) startupdatinglocation;
Stop user positioning-(void) stopupdatinglocation;
Note: 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;
How many meters to locate each time
@property (Assign, nonatomic) cllocationdistance distancefilter;
2.CLLocation
Cllocation the geographic information used to represent a location, such as latitude and longitude, altitude, etc.
(1) Latitude
@property (readonly, nonatomic) Cllocationcoordinate2d coordinate;
(2) Altitude
@property (readonly, nonatomic) cllocationdistance altitude;
(3) Course, course (value range is 0.0°~ 359.9°,0.0° represents true north direction)
@property (readonly, nonatomic) Cllocationdirection course;
(4) Walking speed (unit m/s)
@property (readonly, nonatomic) cllocationspeed speed;
(5) Calculate the distance between 2 positions
-(Cllocationdistance) Distancefromlocation: (const cllocation *) Location method
Positioning accuracy (the more accurate it consumes)
@property (Assign, nonatomic) cllocationaccuracy desiredaccuracy;
3.cllocationcoordinate2d
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
if ([Cllocationmanager locationservicesenabled]) {
[Self.locmgr startupdatinglocation];
Self.locMgr.distanceFilter = Kcldistancefilternone;
Self.locMgr.desiredAccuracy = kcllocationaccuracybestfornavigation;
}
Agent
-(void) Locationmanager: (Cllocationmanager *) Manager didupdatelocations: (nsarray<cllocation *> *) Locations
iOS Learning note 8-map development