1: Positioning the use of life in the mobile internet era, mobile app can solve many of the user's life, such as navigation: go to any unfamiliar place around: looking for restaurants, looking for hotels, looking for banks, looking for cinemas in the above applications, the use of maps and positioning functions 2:ios location-dependent framework in iOS development, to join these 2 features, you must develop a map kit based on 2 frameworks: for the mapping (comparative heavyweight) core location, the positioning of the geo-location Map Kit is based on the core ios Locating hot terms: lbs:location Based servicesolomo:social Local Mobile (Solomon) The 3:corelocation framework uses the Corelocation framework to import primary header files using the prerequisite import framework #import <CoreLocation/CoreLocation.h> Corelocation Framework Usage Note: The prefix for all data types in the Corelocation framework is clcorelocation using Cllocationmanager objects for user positioning 4:cllocationmanager Common operations 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 following method of the proxy is called frequently-(void) Locationmanager: (Cllocationmanager *) Manager Didupdatelocations: (Nsarray *) locations;locations parameter contains Cllocation object cllocation used to represent a location of geographic information, such as latitude and longitude, Elevation et cetera @property (readonly, nonatomic) cllocationcoordinate2d coordinate; latitude Longitude @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 velocity (units m/s) with-( cllocationdistance) Distancefromlocation: (const cllocation *) Location method calculates the distance between 2 locations @property (assign, nonatomic) cllocationdistance distancefilter; position @property (assign, nonatomic) cllocationaccuracy at every number of meters Desiredaccuracy positioning accuracy (the more accurate it consumes) cllocationcoordinate2d is a structure that represents the latitude and longitude, defined as
typedef struct {
Cllocationdegrees latitude; Latitude
Cllocationdegrees longitude; Longitude
} cllocationcoordinate2d;
Generally use the Cllocationcoordinate2dmake function to create cllocationcoordinate2d 5: Protection of user privacy starting with iOS 6, Apple has done a great job of protecting users ' privacy, The following actions must be authorized by the user to obtain the user's location to access the user's address book, Calendar, camera, album and so on when you want to access the user's privacy information, the system will automatically pop up a dialog box to allow users to authorize 5.1 The developer can set the nslocationusagedescription description in a file with the suffix named Info.plist (privacy-location Usage Description) Once the user has selected "Don t Allow "means that your app will not be able to use the positioning function for the sake of rigor, it is best to determine if the current app's positioning function is available before using the positioning function Cllocationmanager has a class method to determine if the current app's positioning function is available + (BOOL) locationservicesenabled;
IOS Maps and targeting features