IOS8 positioning new Features
First, 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.
Second, 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
The continuation of the background location updates, initiated at the time of the program foreground, the Wheninuse mode can also get the correct geographical update, but if it is similar to being aroused from the background of this service, you need to use always authorization
C. added jump to privacy link:uiapplicationopensettingsurlstring when you need to be prompted to turn off the location function, you can jump to the setting screen by the following way:
[[UIApplication sharedapplication] Openurl:[nsurl urlwithstring:uiapplicationopensettingsurlstring]];
E. kclauthorizationstatus, changed from the original kclauthorizationstatusauthorizedto Kclauthorizationstatusauthorizedalways and Kclauthorizationstatusauthorizedwheninuse
Specific Use methods:
A.Decide whether to turn on background mode: Target->capsbilities->backgourn modes
B.In plistAdd Wheninuse/always inThe hint text, using nslocationwheninuseusagedescription/nslocationalwaysuseusagedescription
C.Request a different service:
Location change:
Self.locationmanager = [[Cllocationmanager alloc] init];
Self.locationManager.delegate = self;
[Self.locationmanager requestwheninuseauthorization];
[Self.locationmanager Startupdatinglocation]
Monitor region:
Self.locationmanager = [[Cllocationmanager alloc] init];
Self.locationManager.delegate = self;
Clcircularregion *region = [[Clcircularregion alloc] ...];
[Self.locationmanager requestalwaysauthorization];
[Self.locationmanager startmonitoringforregion:region];
Get a location and listen to region:
In the plist set nslocationwheninuseusagedescription and Nslocationalwaysuseusagedescription, the call method can refer to the above, However, it is important to note that the pattern may need to be judged at all times.
if (authorizationstatus = = Kclauthorizationstatusdenied | | authorizationstatus = = kclauthorizationstatuswheninuse) {
TODO: Do-want e.g goto setting view
}
[Self.locationmanager requestalwaysauthorization];
[Self.locationmanager startmonitoringforregion:region];
D: responstoselector can be used to avoid iOS7 when integrating. errors caused by different ios8api.
E: for positioning that is only used in Mkmapview and HTML5, you also need to add customizations to the hints in plist.
@interface Cllocationmanager (clvisitextensions)
- (void) startmonitoringvisits NSAVAILABLE (NA, 80); Turn on monitoring
- (void) stopmonitoringvisits NSAVAILABLE (NA, 80); Stop Monitoring
Third, the positioning function in the IOS8 has two new methods:
-(void) requestwheninuseauthorization __osx_available_starting (__mac_na, __iphone_8_0);
-(void) requestalwaysauthorization __osx_available_starting (__mac_na, __iphone_8_0);
These two new methods cause the previously written program to appear in IOS8, the location function is not working properly
So let iOS8 normal use positioning function?
<1> you need to add two variables to the Info.plist table
Add two default fields to the Info.plist
These two fields are not particularly interesting in that they are customized to prompt the user for permission to use the geolocation feature.
iOS project development-ios8 Localization API changes