IOS Open Location Feature Cllocationmanager Introduction-Easy to use

Source: Internet
Author: User

The positioning feature in IOS, mainly in the Corelocation library, requires the location manager Cllocationmanager to do most of the things.

To use Cllocationmanager first requires an object ~ and simple settings for it, and finally the positioning function, and then start positioning, positioning success or failure will call the Proxy method return information

 1  cllocationmanager *manger;  2  3  manger = [[Cllocationmanager alloc] INIT]; //  initialize  4  delegate  = self; //  set proxy  6  7  manger.desiredaccuracy = Kcllocationaccuracybest; //  positioning accuracy  8  9  [Manger Startupdatinglocation]; //  start positioning  

When these are set and the positioning is turned on, the proxy method is invoked after the positioning succeeds. Currently, your class must implement a proxy cllocationmanagerdelegate

There are two commonly used proxy methods, locating success and locating failure:

-(void ) Locationmanager: (Cllocationmanager *  *) locations{ for  (cllocation *loc in   locations) {NSLog ( @ "  location:%@   ,[loc description]); }} -(void ) Locationmanager: (Cllocationmanager *         *) error{ NSLog ( @ "  location failed, Reason:%@   " ,[err localizeddescription]); }

Detailed properties, such as precision, the detailed properties of the Cllocation class, and other proxy methods, are interested in flipping through the official documentation, which will be described in more detail later.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.