Welcome to my new blog: Developers say
The application development based on LBS is one of the most popular in mobile development, which mainly involves two aspects of map and location.
In iOS development, location services depend on the Corelocation framework, Cllocationmanager is the core class in Corelocation.
Initialization
if ([cllocationmanagerlocationservicesenabled]) {
self. Locationmanager = [[cllocationmanageralloc]init];
Self. Locationmanager. delegate =self;
self. Locationmanager . Desiredaccuracy =kcllocationaccuracybest;
self. Locationmanager. Distancefilter =Kdistancefilter;
self. Locationmanager. Headingfilter =Kheadingfilter;
self. Locationmanager . pauseslocationupdatesautomatically =YES;
self. Locationmanager . Activitytype =clactivitytypefitness;
}
Desiredaccuracy: To achieve the positioning accuracy, as far as possible to meet the accuracy of the set, but can not be guaranteed in the actual process to achieve.
Distancefilter: Below the horizontal distance is filtered out without generating an update event.
Start Location Services:
[self. Locationmanager startupdatinglocation];
[self. Locationmanager startupdatingheading];
Notifies the agent when it gets to the location information or the location has changed
Get to the new location:
Locationmanager:didupdatelocations
When a change in direction occurs:
Locationmanager:didupdateheading:
For more information, please visit: devsay.com
iOS Location Service corelocation