Core location:? For Geolocation

Source: Internet
Author: User

Core location:? For Geolocation
    • In the mobile internet era, mobile app can solve the user's many? Life trivia, like

    • Navigation: Go to any place where you live?

    • Nearby: Find a restaurant, find a hotel, find a Silver Line, find a movie theater

    • In the above-mentioned should be used in the use of the map and positioning function, in the development of iOS, you want to add to this 2? Large function, must be based on 2 framework in-line development

    • Map Kit:? For the Atlas Show

    • Core location:? For Geolocation

    • 2 Hot Technical Terms

    • Lbs:location Based Service

    • Solomo:social Local Mobile (Solomon)

The corelocation of the frame

Corelocation framework to use the premise

Guide into the framework

Guide to the head? documents

#import <CoreLocation/CoreLocation.h>

Corelocation Framework make use of notice
The prefix for all data types in the Corelocation framework is CL
Corelocation in the Cllocationmanager object? User Orientation

Cllocationmanager

Cllocationmanager's regular operation
Start? user targeting
-(void) startupdatinglocation;

Stop? User orientation
-(void) stopupdatinglocation;

When the Startupdatinglocation method is used, it starts to locate the user's position, which will be adjusted frequently in the middle of the way. Using the agent's next face?

-(void) Locationmanager: (Cllocationmanager *) Managerdidupdatelocations: (Nsarray *) locations;

locations parameters? The Cllocation object is installed in the surface.

Cllocation

Cllocation? The geographic information used to show a location, such as latitude and longitude, altitude, etc.
@property (readonly,nonatomic) cllocationcoordinate2d

coordinate;

• Latitude and longitude
@property (readonly,nonatomic) cllocationdistancealtitude;

• Altitude
@property (readonly,nonatomic) cllocationdirectioncourse;

• Route, course (value range is 0.0°~359.9°,0.0° on behalf of True North? direction)
@property (readonly,nonatomic) cllocationspeedspeed;

• Walking speed (unit m/s)
? with-(Cllocationdistance) Distancefromlocation: (const cllocation

*) Location? method to calculate the distance between 2 positions

Cllocationmanager

@property (Assign, nonatomic) cllocationdistance distancefilter;

How many meters do I have to locate each other?
@property (Assign, nonatomic) cllocationaccuracy

  Desiredaccuracy;

Positioning accuracy (the more accurate it consumes)

Cllocationcoordinate2d

What is cllocationcoordinate2d? A structure that is used to show the latitude and longitude of a table, defined as the following typedef struct {

Cllocationdegrees latitude; Latitude

Cllocationdegrees longitude; Longitude} cllocationcoordinate2d;

? Use the Cllocationcoordinate2dmake function to create a cllocationcoordinate2d

Warp latitude

Analog location

If the simulator, you need to set the analog location (latitude and longitude) Beijing latitude and longitude is: North latitude 40°, longitude 116 °

? Protection of User privacy

Starting with iOS 6, Apple has done a great job of protecting the privacy of its users. The following actions must be passed? User approved authorization

Where do you want to get the user?
Want to access the user's contacts, calendars, cameras, albums, etc.

When you want to access the user's privacy information, the system will automatically pop up? A dialog box lets the user authorize

? Protection of User privacy
    • The developer can set the nslocationusagedescription description in Info.plist. Purpose (privacy-location Usage Description)
    • ? Once the user chooses "do not allow", it means that you should use it later on? cannot be used for positioning function
      For the sake of rigor, it is better to use the positioning function before the positioning function can be used to determine whether or not to use the Cllocationmanager have a class? Method can be used to determine whether the positioning function of the current should be?
      + (BOOL) locationservicesenabled;

Clgeocoder

Enable the Clgeocoder to complete the geocoding and anti-geocoding
Geocoding: Obtain specific location information (such as latitude and longitude, the full name of the address, etc.) according to the given place-name, to obtain specific location information based on the given latitude and longitude

Geo-coding? method

-(void) geocodeaddressstring: (nsstring*) Addressstringcompletionhandler: (Clgeocodecompletionhandler) Completionhandler;

Anti-geocoding? method

-(void) Reversegeocodelocation: (cllocation*) Locationcompletionhandler: (Clgeocodecompletionhandler) Completionhandler;

Clgeocodecompletionhandler

When Geo \ anti-geocoding is complete, it will be tuned to clgeocodecompletionhandler typedef void (^clgeocodecompletionhandler) (Nsarray

*placemarks, Nserror *error); This block passes 2 parameters

Error: When the coding error (, for example, the code does not have specific information) has the value Placemarks: The inside of the face is loaded with Clplacemark object

Clplacemark

Clplacemark word? Meaning is a landmark, encapsulating detailed address location information
@property (nonatomic,readonly) cllocation*location;

• location
@property (nonatomic,readonly) clregion*region;

• Area
@property (nonatomic,readonly) nsdictionary*addressdictionary;

• Detailed address information
@property (nonatomic,readonly) nsstring*name;

• Address Name

@property (nonatomic,readonly) nsstring*locality; City

Core location:? For Geolocation

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.