iOS 8:location Services not working (iOS 8 location failed)

Source: Internet
Author: User

If you are Xcode6 and iOS 8, you need to call the Cllocationmanager Requestalwaysauthorization method, as follows:

1. @interface:
Cllocationmanager *locationmanager;
2. Initialize:
Locationmanager = [[Cllocationmanager alloc] init];
3. Call Request:
[Locationmanager requestalwaysauthorization];
[Locationmanager startupdatinglocation];
4. Add in Info.plist:
Nslocationwheninusedescription, allowing GPS descriptions to be obtained at the front desk
Nslocationalwaysusagedescription, allows the description of GPs to be acquired in the background

PS: It is perfect to judge the iOS version before calling the request.

Perfect for a moment:

Whether IOS 8 is judged
if ([Self.locationmanager respondstoselector: @selector (requestalwaysauthorization)]) {
[Self.locationmanager requestalwaysauthorization]; Permanent License
[Self.locationmanager requestwheninuseauthorization]; Licensing in use
}
[Self.locationmanager startupdatinglocation];

iOS 8:location Services not working (iOS 8 location failed)

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.