Cllocationmanagerdelegate do not call Didupdatelocations (map)

Source: Internet
Author: User

This is due to the location permission setting issue caused by the Xcode upgrade.
Upgrade Xcode6 After opening the previous XCODE5 project, the program cannot be located. Project upgrade to Xcode6 compile requires iOS8 to write their own authorization, or do not have permission to locate.
Workaround:
First, the corresponding default field is added to the Info.plist, the value is set to Yes (foreground position write top field, front and back position write bottom field)
Nslocationwheninuseusagedescription//Allow GPS description to be obtained at the front desk
Nslocationalwaysusagedescription//Allow the description of GPs to be obtained in front and backstage
Rear drawings

First on the code:
?
123456789101112131415161718192021222324252627282930313233343536 #import "ViewController.h"#import <CoreLocation/CoreLocation.h>@interface ViewController ()<CLLocationManagerDelegate>@property (nonatomic, strong) CLLocationManager *locationManager;@end@implementation ViewController//    1. 懒加载初始化:- (CLLocationManager *)locationManager{    if(!_locationManager){        self.locationManager = [[CLLocationManager alloc] init];        self.locationManager.delegate = self;    }    return _locationManager;}- (void)viewDidLoad {    [super viewDidLoad];//    2. 调用请求:    if ([[[UIDevice currentDevice] systemVersion] doubleValue] > 8.0)    {        //设置定位权限 仅ios8有意义        [self.locationManager requestWhenInUseAuthorization];// 前台定位                //  [locationManager requestAlwaysAuthorization];// 前后台同时定位    }    [self.locationManager startUpdatingLocation];}// 3.代理方法- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations{    NSLog(@"%ld",locations.count);}@end



Picture: Figure. png

Cllocationmanagerdelegate do not call Didupdatelocations (map)

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.