Xcode6 iOS8 使用地图无法定位

今天在做地图的时候 无法定位当前位置

 在使用Xcode6 和iOS8 时  需要调用 CLLocationManager requestAlwaysAuthorization 方法,具体步骤如下:

1. @interface里声明:
    CLLocationManager *locationManager;
2. 初始化locationManager:
    locationManager = [[CLLocationManager alloc] init];
3. 调用请求:
    [locationManager requestAlwaysAuthorization];
    [locationManager startUpdatingLocation];
4. 在 info.plist里加入:
    NSLocationWhenInUseDescription,允许在前台获取GPS的描述
    NSLocationAlwaysUsageDescription,允许在后台获取GPS的描述

posted @ 2015-02-05 13:29  二分之一秋天  阅读(143)  评论(0编辑  收藏  举报