Change of location service in IOS8 (Cllocationmanager protocol method does not respond, cannot get back the GPS method, not out

Source: Internet
Author: User

Change of location service in IOS8 (Cllocationmanager protocol method does not respond, unable to return the GPS method, does not appear to get permission prompt)

Recently, when writing a lbs project, because of the adaptation of IOS8, the project was migrated to the Xcode6.0.1, there was a problem that could not get the location service permissions properly.

Self.manger = [[Cllocationmanager alloc]init];self.manger.distancefilter = Kcldistancefilternone; Metersself.manger.delegate = self; [Self.manger requestalwaysauthorization];self.manger.desiredaccuracy = kcllocationaccuracybestfornavigation; [Self.manger startupdatinglocation];

The above is iOS8 before the call method, when the user opens the app, will actively ask whether to allow access to the location service permissions, now in IOS8, whether it is the simulator or the real machine, are not prompted, after a review of official documents-- Locationawarenesspgintroduction found that Apple has enhanced the control of privacy access in iOS8 and must call new methods to get the user's permission

[Self.manager requestwheninuseauthorization];

and add in the Info.plist file

Nslocationwheninuseusagedescription BOOL YES
Nslocationalwaysusagedescription string "Hint description"
Two fields for proper access to service in IOS8


Change of location service in IOS8 (Cllocationmanager protocol method does not respond, cannot get back the GPS method, not out

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.