IOS8 positioning new Features

Source: Internet
Author: User

From the date of the birth of iOS , the system is equipped with the positioning function, with the demand of wireless internet, the changing of mobile function, as well as the continuous upgrading of iOS , positioning function has been continuously updated, since iOS7 joined IBeacon, for wireless mobile push provides more variables, iOS8 inside the positioning function also has a decent performance.
The core location framework
changes in the following main points:
1.
introduce the concept of always and wheninuse in the positioning state.
2.
added the Visit monitoring feature , which is particularly suitable for travel category applications, when the user arrives in a specified area,monitor starts to function.
3.
Adding indoor positioning technology, adding Clfloor, can get the floor information in the room.

Here are the three types of detailed information about how to use.

A. The type of positioning is divided into:

ongoing updates:location, background location, ranging (always/wheninuse work)
Update for monitoring classes:region monitoring, significant location changes
where the continuation of the background location update, in the process of the foreground of the launch, Wheninuse mode can also get correct geolocation updates, but if it's similar to being aroused from the background, you'll need to use always authorization

C . added link:uiapplicationopensettingsurlstring to jump to privacy When you need to be prompted to close the positioning function of the user to use the location can be given by the following ways to jump to the settings screen:

[[UIApplication sharedapplication] Openurl:[nsurl urlwithstring:uiapplicationopensettingsurlstring]];

E. kclauthorizationstatus, from the original kclauthorizationstatusauthorized, into Kclauthorizationstatusauthorizedalways and kclauthorizationstatusauthorizedwheninuse

Specific Use methods:

A.decide whether to turn on background mode:Target->capsbilities->backgourn modes
B.in thePlistIncrease inWheninuse/alwaysthe hint text, usingNslocationwheninuseusagedescription/nslocationalwaysuseusagedescription
C.Request a different service:
Location Change:
Self.locationmanager = [[Cllocationmanager alloc] init];
Self.locationManager.delegate = self;
[Self.locationmanager requestwheninuseauthorization];
[Self.locationmanager Startupdatinglocation]
MonitorRegion
Self.locationmanager = [[Cllocationmanager alloc] init];
Self.locationManager.delegate = self;
Clcircularregion *region = [[Clcircularregion alloc] ...];
[Self.locationmanager requestalwaysauthorization];
[Self.locationmanager startmonitoringforregion:region];
get geolocation and listenRegion
in thePlistin the same time setNslocationwheninuseusagedescriptionand theNslocationalwaysuseusagedescription, the calling method can refer to the above, but it is important to note thatAlwaysthe pattern may need to be judged.
if (authorizationstatus = = Kclauthorizationstatusdenied | | authorizationstatus = = kclauthorizationstatuswheninuse) {
Todo:Do-what-want e.g goto setting view
}
[Self.locationmanager requestalwaysauthorization];
[Self.locationmanager startmonitoringforregion:region];
D:when integrated, you can useResponstoselectorto avoidIOS7.and theIos8apidifferent errors are raised.
E:for just inMkmapviewand theHtml5also need to be used in thePlistAdd a custom to the hint in.

@interface Cllocationmanager (clvisitextensions)

    • (void) startmonitoringvisits NSAVAILABLE (NA, 80); Turn on monitoring
    • (void) stopmonitoringvisits NSAVAILABLE (NA, 80); Stop Monitoring

When the device arrives at the specified location, the system invokes the following method to notify.

    • (void) Locationmanager: (Cllocationmanager *) Manager didvisit: (clvisit *) visit; specific information that can be obtained. @interface clvisit:nsobject @property (nonatomic, readonly, copy) NSDate *arrivaldate; @property (nonatomic, readonly, copy) NSDate *departuredate; @property (nonatomic, readonly) cllocationcoordinate2d coordinate; Center of Region @property (Nonatomic, readonly) cllocationaccuracy horizontalaccuracy;

Use features:

Self.locationmanager = [[Cllocationmanager alloc] init];
Self.locationManager.delegate = self;
[Self.locationmanager requestalwaysauthorization];
[Self.locationmanager Startupdatinglocation]

callback:

    • (void) Locationmanager: (Cllocationmanager *) Manager didupdatelocations: (Nsarray *) Locations {for (Cllocation * NewLocation in locations) {Clfloor *floor = Newlocation.floor; Nsinteger level = Floor.level; } }

IOS8 positioning new Features

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.